forked from comfy/active_link_to
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure Gem via a
.configure
block
comfy#65 If you wanted to use a standard class name for active status (for example in a CSS framework), this was previously not possible. * Implement a standard `.configure` block * Add tests
- Loading branch information
Showing
5 changed files
with
149 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
require 'addressable/uri' | ||
require 'active_link_to/active_link_to' | ||
require 'active_link_to/configuration' | ||
require 'active_link_to/version' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module ActiveLinkTo | ||
class Configuration | ||
attr_accessor :class_active, :class_inactive, :active_disable, :wrap_tag, :wrap_class | ||
|
||
def initialize | ||
@class_active = 'active'.freeze | ||
@class_inactive = ''.freeze | ||
@active_disable = false | ||
@wrap_tag = nil | ||
@wrap_class = ''.freeze | ||
end | ||
end | ||
|
||
def self.configuration | ||
@configuration ||= Configuration.new | ||
end | ||
|
||
def self.configuration=(config) | ||
@configuration = config | ||
end | ||
|
||
def self.configure | ||
yield configuration | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters