Class: Chouette::Command::Option
- Inherits:
-
Object
- Object
- Chouette::Command::Option
- Defined in:
- app/models/chouette/command.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #command_key ⇒ Object
-
#initialize(key, value) ⇒ Option
constructor
A new instance of Option.
- #to_s ⇒ Object
Constructor Details
#initialize(key, value) ⇒ Option
Returns a new instance of Option.
68 69 70 |
# File 'app/models/chouette/command.rb', line 68 def initialize(key, value) @key, @value = key.to_s, value end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
66 67 68 |
# File 'app/models/chouette/command.rb', line 66 def key @key end |
#value ⇒ Object
Returns the value of attribute value.
66 67 68 |
# File 'app/models/chouette/command.rb', line 66 def value @value end |
Instance Method Details
#command_key ⇒ Object
72 73 74 |
# File 'app/models/chouette/command.rb', line 72 def command_key key.camelize(:lower) end |
#to_s ⇒ Object
76 77 78 79 80 81 82 |
# File 'app/models/chouette/command.rb', line 76 def to_s unless value == true "-#{command_key} #{value}" else "-#{command_key}" end end |