Class: Media::Filter
- Inherits:
-
Object
show all
- Defined in:
- lib/media/filter.rb,
lib/media/filter/chain.rb,
lib/media/filter/graph.rb,
lib/media/filter/argument.rb
Defined Under Namespace
Classes: Argument, Chain, Graph
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(args, &block) ⇒ Filter
Returns a new instance of Filter.
10
11
12
13
14
15
16
17
18
|
# File 'lib/media/filter.rb', line 10
def initialize(args, &block)
@name = args.fetch(:name)
@expressions = Array args.fetch(:expressions, [])
@arguments = Array args.fetch(:arguments, [])
@inputs = Array args.fetch(:inputs, [])
@outputs = Array args.fetch(:outputs, [])
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
end
|
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
8
9
10
|
# File 'lib/media/filter.rb', line 8
def name
@name
end
|
Instance Method Details
#arguments(value = nil) ⇒ Object
Also known as:
arguments=
38
39
40
41
42
|
# File 'lib/media/filter.rb', line 38
def arguments(value=nil)
return @arguments unless value
@arguments = value.map {|k,v| Argument.new(key: k, value: v)}
end
|
#expressions(*value) ⇒ Object
Also known as:
expressions=
45
46
47
48
49
|
# File 'lib/media/filter.rb', line 45
def expressions(*value)
return @expressions if value.empty?
@expressions = value
end
|
24
25
26
27
28
|
# File 'lib/media/filter.rb', line 24
def inputs(*value)
return @inputs if value.empty?
@inputs = value.map {|name| Helper::Label.new(name: name)}
end
|
#outputs(*value) ⇒ Object
Also known as:
outputs=
31
32
33
34
35
|
# File 'lib/media/filter.rb', line 31
def outputs(*value)
return @outputs if value.empty?
@outputs = value.map {|name| Helper::Label.new(name: name)}
end
|
#to_s ⇒ Object
20
21
22
|
# File 'lib/media/filter.rb', line 20
def to_s
[inputs, filter, outputs].reject(&:empty?).join(' ')
end
|