Class: Vedeu::API::Stream
- Inherits:
-
Object
- Object
- Vedeu::API::Stream
show all
- Includes:
- Helpers
- Defined in:
- lib/vedeu/api/stream.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Helpers
#colour, #style
Constructor Details
#initialize(attributes = {}, &block) ⇒ Stream
Returns a new instance of Stream.
10
11
12
13
14
15
|
# File 'lib/vedeu/api/stream.rb', line 10
def initialize(attributes = {}, &block)
@attributes = attributes
@self_before_instance_eval = eval('self', block.binding)
instance_eval(&block)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
47
48
49
|
# File 'lib/vedeu/api/stream.rb', line 47
def method_missing(method, *args, &block)
@self_before_instance_eval.send method, *args, &block
end
|
Class Method Details
.build(attributes = {}, &block) ⇒ Object
6
7
8
|
# File 'lib/vedeu/api/stream.rb', line 6
def self.build(attributes = {}, &block)
new(attributes, &block).build
end
|
Instance Method Details
#align(value) ⇒ Object
21
22
23
|
# File 'lib/vedeu/api/stream.rb', line 21
def align(value)
attributes[:align] = value
end
|
#attributes ⇒ Object
33
34
35
|
# File 'lib/vedeu/api/stream.rb', line 33
def attributes
@_attributes ||= defaults.merge!(@attributes)
end
|
#build ⇒ Object
17
18
19
|
# File 'lib/vedeu/api/stream.rb', line 17
def build
attributes
end
|
#defaults ⇒ Object
37
38
39
40
41
42
43
|
# File 'lib/vedeu/api/stream.rb', line 37
def defaults
{
colour: {},
style: [],
text: ''
}
end
|
#text(value) ⇒ Object
25
26
27
|
# File 'lib/vedeu/api/stream.rb', line 25
def text(value)
attributes[:text] = value
end
|
#width(value) ⇒ Object
29
30
31
|
# File 'lib/vedeu/api/stream.rb', line 29
def width(value)
attributes[:width] = value
end
|