Class: Converter
- Inherits:
-
Object
- Object
- Converter
- Defined in:
- lib/puer/converters.rb
Overview
Converters converts data in the xib files property bag to the NodeInfos property bag. The output key it will have is stored here. The converter can be created with a conversion block Converter.new :output {|v| Convert value v hereā¦}
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(output, &conversion) ⇒ Converter
constructor
A new instance of Converter.
- #props_for(value) ⇒ Object
Constructor Details
#initialize(output, &conversion) ⇒ Converter
Returns a new instance of Converter.
6 7 8 9 |
# File 'lib/puer/converters.rb', line 6 def initialize(output, &conversion) @output = output @conversion = conversion || proc {|v| v} end |
Instance Method Details
#props_for(value) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/puer/converters.rb', line 11 def props_for(value) converted_value = @conversion.call(value) if converted_value { @output => converted_value } end end |