Class: Range

Inherits:
Object show all
Includes:
Enumerable
Defined in:
lib/framework/builtinME.rb,
lib/extensions/mspec/mspec/pp.rb

Instance Method Summary collapse

Methods included from Enumerable

#all?, #any?, #collect, #detect, #each_with_index, #find_all, #group_by, #inject, #max, #member?, #min, #sort, #sort_by, #to_a, #to_set

Instance Method Details

#==(value) ⇒ Object



685
686
687
688
689
690
691
# File 'lib/framework/builtinME.rb', line 685

def ==(value)
    if value.first == first and value.last == last and value.exclude_end? == exclude_end?
        true
    else
        false
    end
end

#===(value) ⇒ Object



693
694
695
696
697
698
# File 'lib/framework/builtinME.rb', line 693

def ===(value)
    each do |item|
        return true if value == item
    end
    false
end

#pretty_print(q) ⇒ Object



759
760
761
762
763
764
765
# File 'lib/extensions/mspec/mspec/pp.rb', line 759

def pretty_print(q)
  q.pp self.begin
  q.breakable ''
  q.text(self.exclude_end? ? '...' : '..')
  q.breakable ''
  q.pp self.end
end

#step(n = 1) ⇒ Object



710
711
712
713
714
715
716
717
718
719
720
# File 'lib/framework/builtinME.rb', line 710

def step(n=1)
    if n == 1 then
        each{|i|yield(i)}
    else
        counter = 0
      each do |i|
        yield(i) if counter%n == 0
     counter = counter + 1
  end
end
end

#to_sObject Also known as: inspect



700
701
702
703
# File 'lib/framework/builtinME.rb', line 700

def to_s
    return self.begin.to_s + "..." + self.end.to_s if exclude_end?
    return self.begin.to_s + ".." + self.end.to_s
end