Class: Omnis::Transformer::Property
- Inherits:
-
Object
- Object
- Omnis::Transformer::Property
- Defined in:
- lib/omnis/transformer.rb
Instance Attribute Summary collapse
-
#expr ⇒ Object
readonly
Returns the value of attribute expr.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
Instance Method Summary collapse
- #default ⇒ Object
- #extract(source) ⇒ Object
- #format ⇒ Object
-
#initialize(name, expr, opts, extractor) ⇒ Property
constructor
A new instance of Property.
Constructor Details
#initialize(name, expr, opts, extractor) ⇒ Property
Returns a new instance of Property.
5 6 7 |
# File 'lib/omnis/transformer.rb', line 5 def initialize(name, expr, opts, extractor) @name, @expr, @opts, @extractor = name, expr, opts, extractor end |
Instance Attribute Details
#expr ⇒ Object (readonly)
Returns the value of attribute expr.
4 5 6 |
# File 'lib/omnis/transformer.rb', line 4 def expr @expr end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/omnis/transformer.rb', line 4 def name @name end |
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
4 5 6 |
# File 'lib/omnis/transformer.rb', line 4 def opts @opts end |
Instance Method Details
#default ⇒ Object
9 10 11 |
# File 'lib/omnis/transformer.rb', line 9 def default opts[:default] end |
#extract(source) ⇒ Object
17 18 19 |
# File 'lib/omnis/transformer.rb', line 17 def extract(source) @extractor.call(source) end |
#format ⇒ Object
13 14 15 |
# File 'lib/omnis/transformer.rb', line 13 def format opts[:format] end |