Class: Fleakr::Api::TagOption
- Inherits:
-
SimpleOption
- Object
- SimpleOption
- Fleakr::Api::TagOption
- Defined in:
- lib/fleakr/api/option.rb
Overview
TagOption
Represents values for tags
Instance Attribute Summary
Attributes inherited from SimpleOption
Instance Method Summary collapse
-
#initialize(type, value) ⇒ TagOption
constructor
Tag with specified values.
-
#to_hash ⇒ Object
Hash representation of tag values (separated by spaces).
Constructor Details
#initialize(type, value) ⇒ TagOption
Tag with specified values. Value passed will be converted to an array if it isn’t already
63 64 65 66 |
# File 'lib/fleakr/api/option.rb', line 63 def initialize(type, value) super type, value @value = Array(self.value) end |
Instance Method Details
#to_hash ⇒ Object
Hash representation of tag values (separated by spaces). Handles multi-word tags by enclosing each tag in double quotes.
71 72 73 74 |
# File 'lib/fleakr/api/option.rb', line 71 def to_hash = value.map {|tag| "\"#{tag}\"" } {type => .join(' ')} end |