Class: BitGirder::Ops::Ruby::RubyEnv
- Inherits:
-
BitGirderClass
- Object
- BitGirderClass
- BitGirder::Ops::Ruby::RubyEnv
- Defined in:
- lib/bitgirder/ops/ruby.rb
Class Method Summary collapse
Instance Method Summary collapse
- #get_context(id = nil) ⇒ Object
-
#initialize(*argv) ⇒ RubyEnv
constructor
A new instance of RubyEnv.
Constructor Details
#initialize(*argv) ⇒ RubyEnv
Returns a new instance of RubyEnv.
183 184 185 186 187 188 189 190 191 192 |
# File 'lib/bitgirder/ops/ruby.rb', line 183 def initialize( *argv ) super( *argv ) if @default_id unless @rubies.key?( @default_id ) raise "Default id #@default_id not a defined ruby" end end end |
Class Method Details
.from_mingle_struct(s) ⇒ Object
224 225 226 227 228 229 230 |
# File 'lib/bitgirder/ops/ruby.rb', line 224 def self.from_mingle_struct( s ) self.new( rubies: self.read_rubies_in( s ), default_id: s.get_string( :default_ruby ), ) end |
.read_rubies_in(s) ⇒ Object
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/bitgirder/ops/ruby.rb', line 208 def self.read_rubies_in( s ) ( s[ :rubies ] || [] ).inject( {} ) do |res, mg_ctx| ctx = RubyContext.from_mingle_struct( mg_ctx ) if res.key?( ctx.id ) raise "Env has multiple ruby contexts with id: #{ctx.id}" else res[ ctx.id ] = ctx end res end end |
Instance Method Details
#get_context(id = nil) ⇒ Object
194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/bitgirder/ops/ruby.rb', line 194 def get_context( id = nil ) if id @rubies[ id ] or raise "No ruby context with id: #{id}" else if @default_id @rubies[ @default_id ] or raise "Default context #@default_id not set (!?)" else raise "No default ruby context set" end end end |