Class: FastForward::Option
- Inherits:
-
Object
- Object
- FastForward::Option
- Defined in:
- lib/fastforward/option.rb
Instance Method Summary collapse
- #defaults ⇒ Object
-
#initialize(name, value, opts = {}) ⇒ Option
constructor
A new instance of Option.
- #name ⇒ Object
- #stream(type, index = nil) ⇒ Object
- #stream_specifier ⇒ Object
- #to_s ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(name, value, opts = {}) ⇒ Option
Returns a new instance of Option.
3 4 5 6 7 |
# File 'lib/fastforward/option.rb', line 3 def initialize(name, value, opts={}) @name, @value, @opts = name, value, defaults.merge(opts) @stream_type = nil @stream_index = nil end |
Instance Method Details
#defaults ⇒ Object
15 16 17 |
# File 'lib/fastforward/option.rb', line 15 def defaults { :stream_specifier_allowed => true } end |
#name ⇒ Object
19 20 21 |
# File 'lib/fastforward/option.rb', line 19 def name "-%s%s" % [ @name, stream_specifier ] end |
#stream(type, index = nil) ⇒ Object
9 10 11 12 13 |
# File 'lib/fastforward/option.rb', line 9 def stream(type, index=nil) @stream_type = type @stream_index = index self # For chaining end |
#stream_specifier ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/fastforward/option.rb', line 27 def stream_specifier stream_type = case @stream_type when "audio" then ":a" when "video" then ":v" else "" end stream_type + ( @stream_index ? ":#{@stream_index}" : "" ) end |
#to_s ⇒ Object
38 39 40 |
# File 'lib/fastforward/option.rb', line 38 def to_s "%s %s" % [ name, value] end |
#value ⇒ Object
23 24 25 |
# File 'lib/fastforward/option.rb', line 23 def value @value end |