Class: Media::Output
- Inherits:
-
Object
- Object
- Media::Output
- Defined in:
- lib/media/output.rb
Instance Attribute Summary collapse
-
#maps(*value) ⇒ Object
(also: #maps=)
readonly
Returns the value of attribute maps.
-
#options(value = nil) ⇒ Object
(also: #options=)
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #graph(&block) ⇒ Object (also: #graph=)
-
#initialize(args, &block) ⇒ Output
constructor
A new instance of Output.
- #label(name) ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize(args, &block) ⇒ Output
Returns a new instance of Output.
8 9 10 11 12 13 14 |
# File 'lib/media/output.rb', line 8 def initialize(args, &block) @url = args.fetch(:url) { raise ':url required'} @options = Array args.fetch(:options, []) @maps = Array args.fetch(:maps, []) block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given? end |
Instance Attribute Details
#maps(*value) ⇒ Object (readonly) Also known as: maps=
Returns the value of attribute maps.
6 7 8 |
# File 'lib/media/output.rb', line 6 def maps @maps end |
#options(value = nil) ⇒ Object (readonly) Also known as: options=
Returns the value of attribute options.
6 7 8 |
# File 'lib/media/output.rb', line 6 def @options end |
Instance Method Details
#graph(&block) ⇒ Object Also known as: graph=
38 39 40 41 42 |
# File 'lib/media/output.rb', line 38 def graph(&block) return @graph unless block_given? @graph = Option.new(key: 'filter_complex', value: Filter::Graph.new(&block)) end |
#label(name) ⇒ Object
34 35 36 |
# File 'lib/media/output.rb', line 34 def label(name) Media.label(name) end |
#to_a ⇒ Object
16 17 18 |
# File 'lib/media/output.rb', line 16 def to_a ( + maps << graph).compact.map(&:to_a) + [@url] end |