Class: Media::Option

Inherits:
Object
  • Object
show all
Defined in:
lib/media/option.rb

Instance Method Summary collapse

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_sObject



8
9
10
11
12
13
14
# File 'lib/media/option.rb', line 8

def to_s
  case @value
  when TrueClass  then "-#{@key}"
  when FalseClass then "-no#{@key}"
  else                 "-#{@key} #{@value}"
  end
end