1. ENV
ENV can be inherited by children, but what children do will be transparent to parent.
2. irb
Ways to enable the completion:
The code bellow illustrate the subsession.
While, if you pass an object to the irb command, then the object will be binding to the self, and you can involk all the method directly without the object name.
ENV can be inherited by children, but what children do will be transparent to parent.
puts "In parent, term = #{ENV['TERM']}"
fork do
puts "Start of child 1, term = #{ENV['TERM']}"
ENV['TERM'] = "ansi"
fork do
puts "Start of child 2, term = #{ENV['TERM']}"
end
Process.wait
puts "End of child 1, term = #{ENV['TERM']}"
end
Process.wait
puts "Back in parent, term = #{ENV['TERM']}"
2. irb
2.1 complete facility
Ways to enable the completion:
irb -r irb/completion
irb -r irb/completion
2. subsession and bind
The code bellow illustrate the subsession.
irb(main):001:0> a = 12
=> 12
irb(main):002:0> irb
irb#1(main):001:0> a = [1,2,3]
=> [1, 2, 3]
irb#1(main):002:0> jobs
=> #0->irb on main (#<Thread:0x007fdd328bc8d0>: stop)
#1->irb#1 on main (#<Thread:0x007fdd339fb6a0>: running)
irb#1(main):003:0> fg 0
=> #<IRB::Irb: @context=#<IRB::Context:0x007fdd339c82c8>, @signal_status=:IN_EVAL, @scanner=#<RubyLex:0x007fdd3281d690>>
irb(main):003:0> a
=> 12
While, if you pass an object to the irb command, then the object will be binding to the self, and you can involk all the method directly without the object name.
irb(main):001:0> a = [1,2,3]
=> [1, 2, 3]
irb(main):002:0> irb a
irb#1([1, 2, 3]):001:0> size
=> 3
irb#1([1, 2, 3]):002:0> reverse
=> [3, 2, 1]
irb#1([1, 2, 3]):003:0> self
=> [1, 2, 3]
irb#1([1, 2, 3]):004:0> irb_exit
=> #<IRB::Irb: @context=#<IRB::Context:0x007fd2fa2c4320>, @signal_status=:IN_EVAL, @scanner=#<RubyLex:0x007fd2fb809708>>
irb(main):003:0> a
=> [1, 2, 3]
irb(main):004:0> size
NameError: undefined local variable or method `size' for main:Object
from (irb):4
from /usr/bin/irb:12:in `<main>'
irb(main):005:0>