Class: Mwc::Environment Private
- Inherits:
-
Object
- Object
- Mwc::Environment
- Defined in:
- lib/mwc/environment.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
The compile environment manager
Instance Attribute Summary collapse
- #environments ⇒ Object readonly private
- #mruby ⇒ Object readonly private
- #project ⇒ Object readonly private
Instance Method Summary collapse
-
#env(name, &block) ⇒ Object
private
Define new environment.
-
#initialize(parent = nil, &block) ⇒ Environment
constructor
private
A new instance of Environment.
Constructor Details
#initialize(parent = nil, &block) ⇒ Environment
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Environment.
18 19 20 21 22 23 24 |
# File 'lib/mwc/environment.rb', line 18 def initialize(parent = nil, &block) @parent = parent @environments = {} @project = Options::Project.new(parent&.project) @mruby = Options::MRuby.new(parent&.mruby) instance_exec(self, &block) if block_given? end |
Instance Attribute Details
#environments ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 |
# File 'lib/mwc/environment.rb', line 14 def environments @environments end |
#mruby ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 |
# File 'lib/mwc/environment.rb', line 14 def mruby @mruby end |
#project ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 |
# File 'lib/mwc/environment.rb', line 14 def project @project end |
Instance Method Details
#env(name, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Define new environment
33 34 35 36 37 |
# File 'lib/mwc/environment.rb', line 33 def env(name, &block) return if @parent @environments[name.to_sym] = Environment.new(self, &block) end |