Class: Vedeu::Line
- Inherits:
-
Object
- Object
- Vedeu::Line
- Includes:
- Coercions, Presentation
- Defined in:
- lib/vedeu/models/line.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Class Method Summary collapse
Instance Method Summary collapse
- #defaults ⇒ Hash private private
- #initialize(attributes = {}, &block) ⇒ Line constructor
-
#method_missing(method, *args, &block) ⇒ Object
private
private
[].
- #streams ⇒ Array
- #to_s ⇒ String
Methods included from Presentation
Methods included from Coercions
Constructor Details
#initialize(attributes = {}, &block) ⇒ Line
18 19 20 21 22 23 24 25 26 |
# File 'lib/vedeu/models/line.rb', line 18 def initialize(attributes = {}, &block) @attributes = defaults.merge!(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 (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns [].
52 53 54 |
# File 'lib/vedeu/models/line.rb', line 52 def method_missing(method, *args, &block) @self_before_instance_eval.send(method, *args, &block) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
6 7 8 |
# File 'lib/vedeu/models/line.rb', line 6 def attributes @attributes end |
Class Method Details
.build(attributes = {}, &block) ⇒ Hash
11 12 13 |
# File 'lib/vedeu/models/line.rb', line 11 def self.build(attributes = {}, &block) new(attributes, &block).attributes end |
Instance Method Details
#defaults ⇒ Hash (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
42 43 44 45 46 47 48 |
# File 'lib/vedeu/models/line.rb', line 42 def defaults { colour: {}, streams: [], style: [] } end |
#streams ⇒ Array
29 30 31 |
# File 'lib/vedeu/models/line.rb', line 29 def streams @streams ||= Stream.coercer(attributes[:streams]) end |
#to_s ⇒ String
34 35 36 |
# File 'lib/vedeu/models/line.rb', line 34 def to_s [ colour, style, streams ].join end |