Skip to main content

Posts

Showing posts with the label .reject

Reject, Select, is_a?, count, %w, regex

- Learnt EC2 basics from AWS and security groups - Learnt .floor and .ceil puts 2.67.ceil == 2 #=> false, because 2.67.ceil is 3 puts 2.67.floor == 2 #=> true, because true - Learnt is_a? Returns true if class is the class of obj, or if class is one of the superclasses of obj or modules included in obj. module M;    end class A   include M end class B < A; end class C < B; end b is an object of Class B and is A is the superclass of B. b will return true if B it belongs to class B or class A but not class C even if it is a subset of class B. It will return true if M is a module of class A or class B. b = B.new b.is_a? A          #=> true b.is_a? B          #=> true b.is_a? C          #=> false b.is_a? M          #=> true b.kind_of? A       #=> true b.kind_of? B       #=> true b.kind_of? C ...