Class: Screenomat::DSL::Builder
- Inherits:
-
Object
- Object
- Screenomat::DSL::Builder
- Defined in:
- lib/screenomat/dsl/builder.rb
Instance Attribute Summary collapse
-
#sessions ⇒ Object
readonly
Returns the value of attribute sessions.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #first ⇒ Object
-
#initialize(code = '', &block) ⇒ Builder
constructor
A new instance of Builder.
- #session(name = nil, &block) ⇒ Object
Constructor Details
#initialize(code = '', &block) ⇒ Builder
Returns a new instance of Builder.
8 9 10 11 12 13 14 15 16 |
# File 'lib/screenomat/dsl/builder.rb', line 8 def initialize(code = '', &block) @sessions = [] if !code.empty? instance_eval(code) else instance_eval(&block) end end |
Instance Attribute Details
#sessions ⇒ Object (readonly)
Returns the value of attribute sessions.
6 7 8 |
# File 'lib/screenomat/dsl/builder.rb', line 6 def sessions @sessions end |
Instance Method Details
#[](key) ⇒ Object
30 31 32 |
# File 'lib/screenomat/dsl/builder.rb', line 30 def [](key) @sessions.find { |session| session.name == key } end |
#first ⇒ Object
26 27 28 |
# File 'lib/screenomat/dsl/builder.rb', line 26 def first @sessions.first end |