Class: Vedeu::Stream
- Inherits:
-
Object
show all
- Defined in:
- lib/vedeu/models/stream.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(attributes = {}, &block) ⇒ Stream
Returns a new instance of Stream.
7
8
9
10
11
12
13
14
15
|
# File 'lib/vedeu/models/stream.rb', line 7
def initialize(attributes = {}, &block)
@attributes = attributes
if block_given?
@self_before_instance_eval = eval('self', block.binding)
instance_eval(&block)
end
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
73
74
75
|
# File 'lib/vedeu/models/stream.rb', line 73
def method_missing(method, *args, &block)
@self_before_instance_eval.send(method, *args, &block)
end
|
Class Method Details
.build(attributes = {}, &block) ⇒ Object
3
4
5
|
# File 'lib/vedeu/models/stream.rb', line 3
def self.build(attributes = {}, &block)
new(attributes, &block).attributes
end
|
Instance Method Details
#align ⇒ Object
37
38
39
|
# File 'lib/vedeu/models/stream.rb', line 37
def align
@align ||= attributes[:align]
end
|
#attributes ⇒ Object
17
18
19
|
# File 'lib/vedeu/models/stream.rb', line 17
def attributes
@_attributes ||= defaults.merge!(@attributes)
end
|
#colour ⇒ Object
21
22
23
|
# File 'lib/vedeu/models/stream.rb', line 21
def colour
@colour ||= Colour.new(attributes[:colour])
end
|
#style ⇒ Object
25
26
27
|
# File 'lib/vedeu/models/stream.rb', line 25
def style
@style ||= Attributes.coerce_styles(attributes[:style])
end
|
#text ⇒ Object
29
30
31
|
# File 'lib/vedeu/models/stream.rb', line 29
def text
@text ||= attributes[:text]
end
|
#to_s ⇒ Object
41
42
43
|
# File 'lib/vedeu/models/stream.rb', line 41
def to_s
[ colour, style, data ].join
end
|
#width ⇒ Object
33
34
35
|
# File 'lib/vedeu/models/stream.rb', line 33
def width
@width ||= attributes[:width]
end
|