Class: Logiku::Formatters::KeyValue
- Inherits:
-
Object
- Object
- Logiku::Formatters::KeyValue
- Defined in:
- lib/logiku/formatters/key_value.rb
Instance Attribute Summary collapse
-
#filter ⇒ Object
readonly
Returns the value of attribute filter.
Instance Method Summary collapse
- #call(data) ⇒ Object
-
#initialize(filter = nil) ⇒ KeyValue
constructor
A new instance of KeyValue.
Constructor Details
#initialize(filter = nil) ⇒ KeyValue
Returns a new instance of KeyValue.
5 6 7 |
# File 'lib/logiku/formatters/key_value.rb', line 5 def initialize(filter = nil) @filter = filter end |
Instance Attribute Details
#filter ⇒ Object (readonly)
Returns the value of attribute filter.
3 4 5 |
# File 'lib/logiku/formatters/key_value.rb', line 3 def filter @filter end |
Instance Method Details
#call(data) ⇒ Object
9 10 11 12 13 |
# File 'lib/logiku/formatters/key_value.rb', line 9 def call(data) = "#{data.map { |k, v| format k, v }.join(" ")}\n" = filter.call() unless filter.nil? end |