Module: Kamaze::DockerImage::Loader::Context
- Defined in:
- lib/kamaze/docker_image/loader/context.rb
Overview
Provides empty binding.
Sample of use:
Context.call do |b|
b.local_variable_set(:answer, 42)
b.local_variable_set(:home, '127.0.0.1')
b.eval(content)
end
Class Method Summary collapse
- .binding ⇒ Binding protected
- .call {|binding| ... } ⇒ Object
- .dsl ⇒ Rake::DSL? protected
-
.dsl? ⇒ Boolean
Denote
DSLis defined. -
.load_dsl ⇒ self
protected
Apply
Rake::DSL.
Class Method Details
.binding ⇒ Binding (protected)
39 40 41 |
# File 'lib/kamaze/docker_image/loader/context.rb', line 39 def binding -> { super }.tap { load_dsl }.call end |
.call {|binding| ... } ⇒ Object
25 26 27 |
# File 'lib/kamaze/docker_image/loader/context.rb', line 25 def call yield(binding) end |
.dsl ⇒ Rake::DSL? (protected)
44 45 46 47 48 |
# File 'lib/kamaze/docker_image/loader/context.rb', line 44 def dsl Object.const_get('Rake::DSL') rescue NameError nil end |
.dsl? ⇒ Boolean
Denote DSL is defined.
32 33 34 |
# File 'lib/kamaze/docker_image/loader/context.rb', line 32 def dsl? !!dsl end |
.load_dsl ⇒ self (protected)
Apply Rake::DSL
53 54 55 |
# File 'lib/kamaze/docker_image/loader/context.rb', line 53 def load_dsl self.tap { self.extend(dsl) if dsl? } end |