Class: Thot::Processor
- Inherits:
-
Object
- Object
- Thot::Processor
- Defined in:
- lib/thot/processor.rb
Instance Attribute Summary collapse
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value:, rule:) ⇒ Processor
constructor
A new instance of Processor.
- #result ⇒ Object
Constructor Details
#initialize(value:, rule:) ⇒ Processor
Returns a new instance of Processor.
6 7 8 9 |
# File 'lib/thot/processor.rb', line 6 def initialize(value: , rule:) @value = value @rule = rule end |
Instance Attribute Details
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
4 5 6 |
# File 'lib/thot/processor.rb', line 4 def rule @rule end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'lib/thot/processor.rb', line 3 def value @value end |
Instance Method Details
#result ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/thot/processor.rb', line 11 def result if @value.nil? then result = (@rule[:default])? @rule[:default] : '' else result = @value @rule[:filters].each do |filter| result = result.send filter.to_sym if result.respond_to? filter.to_sym end end return result end |