Class: Vedeu::DSL::Stream
- Inherits:
-
Object
- Object
- Vedeu::DSL::Stream
- Includes:
- Vedeu::DSL, Colour, Style, Text
- Defined in:
- lib/vedeu/dsl/stream.rb
Overview
Provides methods to be used to define views.
Instance Attribute Summary collapse
- #client ⇒ Object readonly private
- #model ⇒ Stream readonly private
Instance Method Summary collapse
- #attributes ⇒ Hash private
-
#initialize(model, client = nil) ⇒ Vedeu::DSL::Stream
constructor
Returns an instance of DSL::Stream.
- #stream(&block) ⇒ void
Methods included from Text
#stream_attributes, #stream_builder, #text
Methods included from Style
Methods included from Colour
#background, #colour, #foreground
Methods included from Vedeu::DSL
Constructor Details
#initialize(model, client = nil) ⇒ Vedeu::DSL::Stream
Returns an instance of DSL::Stream.
23 24 25 26 |
# File 'lib/vedeu/dsl/stream.rb', line 23 def initialize(model, client = nil) @model = model @client = client end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Vedeu::DSL
Instance Attribute Details
#client ⇒ Object (readonly, private)
40 41 42 |
# File 'lib/vedeu/dsl/stream.rb', line 40 def client @client end |
#model ⇒ Stream (readonly, private)
43 44 45 |
# File 'lib/vedeu/dsl/stream.rb', line 43 def model @model end |
Instance Method Details
#attributes ⇒ Hash (private)
46 47 48 49 50 51 |
# File 'lib/vedeu/dsl/stream.rb', line 46 def attributes { client: client, parent: model.parent, } end |
#stream(&block) ⇒ void
This method returns an undefined value.
31 32 33 34 35 |
# File 'lib/vedeu/dsl/stream.rb', line 31 def stream(&block) fail InvalidSyntax, 'block not given' unless block_given? model.add(model.class.build(attributes, &block)) end |