Class: Antelope::DSL::Contexts::Base
- Inherits:
-
Object
- Object
- Antelope::DSL::Contexts::Base
show all
- Defined in:
- lib/antelope/dsl/contexts/base.rb
Overview
The base context, which implements some helper methods.
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options) ⇒ Base
Returns a new instance of Base.
8
9
10
11
|
# File 'lib/antelope/dsl/contexts/base.rb', line 8
def initialize(options)
@options = options
@contexts = Hash.new { |h, k| h[k] = k.new(@options) }
end
|
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
6
7
8
|
# File 'lib/antelope/dsl/contexts/base.rb', line 6
def options
@options
end
|
Instance Method Details
#before_call ⇒ Object
23
|
# File 'lib/antelope/dsl/contexts/base.rb', line 23
def before_call; end
|
#call(&block) ⇒ Object
13
14
15
16
17
|
# File 'lib/antelope/dsl/contexts/base.rb', line 13
def call(&block)
before_call
instance_exec(self, &block)
data
end
|
#context(name, &block) ⇒ Object
19
20
21
|
# File 'lib/antelope/dsl/contexts/base.rb', line 19
def context(name, &block)
@contexts[name].call(&block)
end
|
#data ⇒ Object
25
|
# File 'lib/antelope/dsl/contexts/base.rb', line 25
def data; end
|