Class: Omnis::Transformer::Property

Inherits:
Object
  • Object
show all
Defined in:
lib/omnis/transformer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#exprObject (readonly)

Returns the value of attribute expr.



4
5
6
# File 'lib/omnis/transformer.rb', line 4

def expr
  @expr
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/omnis/transformer.rb', line 4

def name
  @name
end

#optsObject (readonly)

Returns the value of attribute opts.



4
5
6
# File 'lib/omnis/transformer.rb', line 4

def opts
  @opts
end

Instance Method Details

#defaultObject



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

#formatObject



13
14
15
# File 'lib/omnis/transformer.rb', line 13

def format
  opts[:format]
end