Class: Media::Option
- Inherits:
-
Object
- Object
- Media::Option
- Defined in:
- lib/media/option.rb
Instance Method Summary collapse
-
#initialize(args) ⇒ Option
constructor
A new instance of Option.
- #to_a ⇒ Object
Constructor Details
#initialize(args) ⇒ Option
Returns a new instance of Option.
3 4 5 6 |
# File 'lib/media/option.rb', line 3 def initialize(args) @key = args.fetch(:key) @value = args.fetch(:value, true) end |
Instance Method Details
#to_a ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/media/option.rb', line 8 def to_a case @value when TrueClass then ["-#{@key}"] when FalseClass then ["-no#{@key}"] else ["-#{@key}", @value.to_s] end end |