Mercurial > repos > other > SevenLanguagesInSevenWeeks
view 1-Ruby/object-all-things-irb.output @ 35:22edfbf3b8bd
Add most of the self-study answers
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 06 Sep 2017 19:54:35 +0100 |
parents | 2b423d86da51 |
children |
line wrap: on
line source
object-all-things.rb(main):001:0> #! /usr/bin/env ruby object-all-things.rb(main):002:0* object-all-things.rb(main):003:0* 4 => 4 object-all-things.rb(main):004:0> 4.class => Fixnum object-all-things.rb(main):005:0> puts 4.class Fixnum => nil object-all-things.rb(main):006:0> 4 + 4 => 8 object-all-things.rb(main):007:0> puts 4 + 4 8 => nil object-all-things.rb(main):008:0> 4.methods => [:to_s, :inspect, :-@, :+, :-, :*, :/, :div, :%, :modulo, :divmod, :fdiv, :**, :abs, :magnitude, :==, :===, :<=>, :>, :>=, :<, :<=, :~, :&, :|, :^, :[], :<<, :>>, :to_f, :size, :bit_length, :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?, :remainder, :real?, :nonzero?, :step, :quo, :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, :singleton_method, :define_singleton_method, :object_id, :to_enum, :enum_for, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__, :__id__] object-all-things.rb(main):009:0> 4.methods.each { |method| puts "4.#{method}" } 4.to_s 4.inspect 4.-@ 4.+ 4.- 4.* 4./ 4.div 4.% 4.modulo 4.divmod 4.fdiv 4.** 4.abs 4.magnitude 4.== 4.=== 4.<=> 4.> 4.>= 4.< 4.<= 4.~ 4.& 4.| 4.^ 4.[] 4.<< 4.>> 4.to_f 4.size 4.bit_length 4.zero? 4.odd? 4.even? 4.succ 4.integer? 4.upto 4.downto 4.times 4.next 4.pred 4.chr 4.ord 4.to_i 4.to_int 4.floor 4.ceil 4.truncate 4.round 4.gcd 4.lcm 4.gcdlcm 4.numerator 4.denominator 4.to_r 4.rationalize 4.singleton_method_added 4.coerce 4.i 4.+@ 4.eql? 4.remainder 4.real? 4.nonzero? 4.step 4.quo 4.to_c 4.real 4.imaginary 4.imag 4.abs2 4.arg 4.angle 4.phase 4.rectangular 4.rect 4.polar 4.conjugate 4.conj 4.between? 4.nil? 4.=~ 4.!~ 4.hash 4.class 4.singleton_class 4.clone 4.dup 4.taint 4.tainted? 4.untaint 4.untrust 4.untrusted? 4.trust 4.freeze 4.frozen? 4.methods 4.singleton_methods 4.protected_methods 4.private_methods 4.public_methods 4.instance_variables 4.instance_variable_get 4.instance_variable_set 4.instance_variable_defined? 4.remove_instance_variable 4.instance_of? 4.kind_of? 4.is_a? 4.tap 4.send 4.public_send 4.respond_to? 4.extend 4.display 4.method 4.public_method 4.singleton_method 4.define_singleton_method 4.object_id 4.to_enum 4.enum_for 4.equal? 4.! 4.!= 4.instance_eval 4.instance_exec 4.__send__ 4.__id__ => [:to_s, :inspect, :-@, :+, :-, :*, :/, :div, :%, :modulo, :divmod, :fdiv, :**, :abs, :magnitude, :==, :===, :<=>, :>, :>=, :<, :<=, :~, :&, :|, :^, :[], :<<, :>>, :to_f, :size, :bit_length, :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?, :remainder, :real?, :nonzero?, :step, :quo, :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, :singleton_method, :define_singleton_method, :object_id, :to_enum, :enum_for, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__, :__id__] object-all-things.rb(main):010:0>