Class: GemLoader::Context::Dsl
- Inherits:
-
Object
- Object
- GemLoader::Context::Dsl
- Defined in:
- lib/gem_loader/context/dsl.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
Instance Method Summary collapse
-
#initialize(context, &block) ⇒ Dsl
constructor
A new instance of Dsl.
- #scope(arg, &block) ⇒ Object
Constructor Details
#initialize(context, &block) ⇒ Dsl
Returns a new instance of Dsl.
15 16 17 18 |
# File 'lib/gem_loader/context/dsl.rb', line 15 def initialize(context, &block) self.context = context instance_eval(&block) if block end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
13 14 15 |
# File 'lib/gem_loader/context/dsl.rb', line 13 def context @context end |
Instance Method Details
#scope(arg, &block) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/gem_loader/context/dsl.rb', line 20 def scope(arg, &block) if arg.is_a?(Hash) name = arg.keys.first depend_scope_names = [ arg[name] ].flatten else name = arg depend_scope_names = [] end scope = self.context.scope(name) depend_scope_names.each do |name| scope.add_depend_scope(self.context.scope(name)) end scope.dsl(&block) end |