Class: Media::Output

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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
  @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_aObject



16
17
18
# File 'lib/media/output.rb', line 16

def to_a
  (options + maps << graph).compact.map(&:to_a) + [@url]
end