Script started on Wed Nov 2 13:29:44 2016 [?1034hbash-3.2$ ruby -v ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15] bash-3.2$ irb irb(main):001:0> 1 => 1 irb(main):002:0> 1+2 => 3 irb(main):003:0> 1.+(2) => 3 irb(main):004:0> 1.class => Fixnum irb(main):005:0> 1.methods => [:to_s, :inspect, :-@, :+, :-, :*, :/, :div, :%, :modulo, :divmod, :fdiv, :**, :abs, :magnitude, :==, :===, :<=>, :>, :>=, :<, :<=, :~, :&, :|, :^, :[], :<<, :>>, :to_f, :size, :zero?, :odd?, :even?, :succ, :integer?, :upto, :downto, :times, :next, :pred, :chr, :ord, :to_i, :to_int, :floor, :ceil, :truncate, :round, :gcd, :lcm, :gcdlcm, :numerator, :denominator, :to_r, :rationalize, :singleton_method_added, :coerce, :i, :+@, :eql?, :quo, :remainder, :real?, :nonzero?, :step, :to_c, :real, :imaginary, :imag, :abs2, :arg, :angle, :phase, :rectangular, :rect, :polar, :conjugate, :conj, :between?, :nil?, :=~, :!~, :hash, :class, :singleton_class, :clone, :dup, :taint, :tainted?, :untaint, :untrust, :untrusted?, :trust, :freeze, :frozen?, :methods, :singleton_methods, :protected_methods, :private_methods, :public_methods, :instance_variables, :instance_variable_get, :instance_variable_set, :instance_variable_defined?, :remove_instance_variable, :instance_of?, :kind_of?, :is_a?, :tap, :send, :public_send, :respond_to?, :extend, :display, :method, :public_method, :define_singleton_method, :object_id, :to_enum, :enum_for, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__, :__id__] irb(main):006:0> 1.5.methods => [:to_s, :inspect, :coerce, :-@, :+, :-, :*, :/, :quo, :fdiv, :%, :modulo, :divmod, :**, :==, :===, :<=>, :>, :>=, :<, :<=, :eql?, :hash, :to_f, :abs, :magnitude, :zero?, :to_i, :to_int, :floor, :ceil, :round, :truncate, :nan?, :infinite?, :finite?, :numerator, :denominator, :to_r, :rationalize, :arg, :angle, :phase, :singleton_method_added, :i, :+@, :div, :remainder, :real?, :integer?, :nonzero?, :step, :to_c, :real, :imaginary, :imag, :abs2, :rectangular, :rect, :polar, :conjugate, :conj, :between?, :nil?, :=~, :!~, :class, :singleton_class, :clone, :dup, :taint, :tainted?, :untaint, :untrust, :untrusted?, :trust, :freeze, :frozen?, :methods, :singleton_methods, :protected_methods, :private_methods, :public_methods, :instance_variables, :instance_variable_get, :instance_variable_set, :instance_variable_defined?, :remove_instance_variable, :instance_of?, :kind_of?, :is_a?, :tap, :send, :public_send, :respond_to?, :extend, :display, :method, :public_method, :define_singleton_method, :object_id, :to_enum, :enum_for, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__, :__id__] irb(main):007:0> 1.5.floor => 1 irb(main):008:0> false => false irb(main):009:0> false.class => FalseClass irb(main):010:0> FalseClass.methods => [:allocate, :superclass, :freeze, :===, :==, :<=>, :<, :<=, :>, :>=, :to_s, :inspect, :included_modules, :include?, :name, :ancestors, :instance_methods, :public_instance_methods, :protected_instance_methods, :private_instance_methods, :constants, :const_get, :const_set, :const_defined?, :const_missing, :class_variables, :remove_class_variable, :class_variable_get, :class_variable_set, :class_variable_defined?, :public_constant, :private_constant, :module_exec, :class_exec, :module_eval, :class_eval, :method_defined?, :public_method_defined?, :private_method_defined?, :protected_method_defined?, :public_class_method, :private_class_method, :autoload, :autoload?, :instance_method, :public_instance_method, :nil?, :=~, :!~, :eql?, :hash, :class, :singleton_class, :clone, :dup, :taint, :tainted?, :untaint, :untrust, :untrusted?, :trust, :frozen?, :methods, :singleton_methods, :protected_methods, :private_methods, :public_methods, :instance_variables, :instance_variable_get, :instance_variable_set, :instance_variable_defined?, :remove_instance_variable, :instance_of?, :kind_of?, :is_a?, :tap, :send, :public_send, :respond_to?, :extend, :display, :method, :public_method, :define_singleton_method, :object_id, :to_enum, :enum_for, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__, :__id__] irb(main):011:0> true.class => TrueClass irb(main):012:0> true.class.class => Class irb(main):013:0> Class.class => Class irb(main):014:0> 1.5.class => Float irb(main):015:0> 1.foo NoMethodError: undefined method `foo' for 1:Fixnum from (irb):15 from /usr/bin/irb:12:in `
' irb(main):016:0> class Fixnum irb(main):017:1> def foo irb(main):018:2> "bar" irb(main):019:2> end irb(main):020:1> end => nil irb(main):021:0> 1.foo => "bar" irb(main):022:0> 1.methods => [:to_s, :inspect, :-@, :+, :-, :*, :/, :div, :%, :modulo, :divmod, :fdiv, :**, :abs, :magnitude, :==, :===, :<=>, :>, :>=, :<, :<=, :~, :&, :|, :^, :[], :<<, :>>, :to_f, :size, :zero?, :odd?, :even?, :succ, :foo, :integer?, :upto, :downto, :times, :next, :pred, :chr, :ord, :to_i, :to_int, :floor, :ceil, :truncate, :round, :gcd, :lcm, :gcdlcm, :numerator, :denominator, :to_r, :rationalize, :singleton_method_added, :coerce, :i, :+@, :eql?, :quo, :remainder, :real?, :nonzero?, :step, :to_c, :real, :imaginary, :imag, :abs2, :arg, :angle, :phase, :rectangular, :rect, :polar, :conjugate, :conj, :between?, :nil?, :=~, :!~, :hash, :class, :singleton_class, :clone, :dup, :taint, :tainted?, :untaint, :untrust, :untrusted?, :trust, :freeze, :frozen?, :methods, :singleton_methods, :protected_methods, :private_methods, :public_methods, :instance_variables, :instance_variable_get, :instance_variable_set, :instance_variable_defined?, :remove_instance_variable, :instance_of?, :kind_of?, :is_a?, :tap, :send, :public_send, :respond_to?, :extend, :display, :method, :public_method, :define_singleton_method, :object_id, :to_enum, :enum_for, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__, :__id__] irb(main):023:0> 1+1 => 2 irb(main):024:0> 5.foo => "bar" irb(main):025:0> 1+2 => 3 irb(main):026:0> 1.+(2) => 3 irb(main):027:0> class Fixnum irb(main):028:1> def +(x) irb(main):029:2> 42 irb(main):030:2> end irb(main):031:1> end => nil irb(main):032:0> 1+2 => 42 irb(main):042:0> 3+5 => 42 irb(main):042:0> class Fixnum irb(main):042:42> def +(x) irb(main):042:41> 17 irb(main):042:41> end irb(main):042:40> end irb(main):042:39> 1+2 irb(main):042:39> 1+2 irb(main):042:39> end irb(main):042:38> end irb(main):042:37> end irb(main):042:36> ^D SyntaxError: (irb):49: syntax error, unexpected keyword_end, expecting end-of-input from /usr/bin/irb:12:in `
' bash-3.2$ irb irb(main):001:0> load "silly.rb" Hello, World! => true irb(main):002:0> athing = A.new => # irb(main):003:0> athing.class => A irb(main):004:0> a.m1 NameError: undefined local variable or method `a' for main:Object from (irb):4 from /usr/bin/irb:12:in `
' irb(main):005:0> athing.m1 => 34 irb(main):006:0> athing.m1(2,3) => 23 irb(main):007:0> ^D bash-3.2$ exit Script done on Wed Nov 2 14:20:29 2016