Class: HolePunch::BaseDSL
- Inherits:
-
Object
- Object
- HolePunch::BaseDSL
show all
- Defined in:
- lib/holepunch/dsl.rb
Instance Method Summary
collapse
Constructor Details
#initialize(env, model) ⇒ BaseDSL
Returns a new instance of BaseDSL.
25
26
27
28
|
# File 'lib/holepunch/dsl.rb', line 25
def initialize(env, model)
@env = env
@model = model
end
|
Instance Method Details
#env ⇒ Object
39
40
41
42
|
# File 'lib/holepunch/dsl.rb', line 39
def env
raise EnvNotDefinedError, 'env not defined' if @env.nil?
@env
end
|
#eval_dsl(filename = nil, &block) ⇒ Object
30
31
32
33
34
35
36
37
|
# File 'lib/holepunch/dsl.rb', line 30
def eval_dsl(filename = nil, &block)
if !filename.nil?
instance_eval(HolePunch.read_file(filename.to_s), filename.to_s, 1)
else
instance_eval(&block) if block_given?
end
@model
end
|