Class: Acts::Permalink::Config
- Inherits:
-
Object
- Object
- Acts::Permalink::Config
- Defined in:
- lib/config.rb
Instance Attribute Summary collapse
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#max_length ⇒ Object
readonly
Returns the value of attribute max_length.
-
#separator ⇒ Object
readonly
Returns the value of attribute separator.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(options = {}) ⇒ Config
Returns a new instance of Config.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/config.rb', line 6 def initialize(={}) @config = .with_indifferent_access @to = @config[:to].try(:to_sym) || :permalink @from = @config[:from].try(:to_sym) || :title @separator = @config[:underscore] ? "_" : "-" @max_length = @config[:max_length].to_i rescue 0 @max_length = 60 unless @max_length > 0 end |
Instance Attribute Details
#from ⇒ Object (readonly)
Returns the value of attribute from.
4 5 6 |
# File 'lib/config.rb', line 4 def from @from end |
#max_length ⇒ Object (readonly)
Returns the value of attribute max_length.
4 5 6 |
# File 'lib/config.rb', line 4 def max_length @max_length end |
#separator ⇒ Object (readonly)
Returns the value of attribute separator.
4 5 6 |
# File 'lib/config.rb', line 4 def separator @separator end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
4 5 6 |
# File 'lib/config.rb', line 4 def to @to end |