class Webspicy::Support::StatusRange

Attributes

range[R]

Public Class Methods

int(i) click to toggle source
# File lib/webspicy/support/status_range.rb, line 10
def self.int(i)
  new(i..i)
end
new(range) click to toggle source
# File lib/webspicy/support/status_range.rb, line 5
def initialize(range)
  @range = range
end
str(s) click to toggle source
# File lib/webspicy/support/status_range.rb, line 18
def self.str(s)
  from = s[/^(\d)/,1].to_i * 100
  new(from...from+100)
end

Public Instance Methods

==(other) click to toggle source
# File lib/webspicy/support/status_range.rb, line 35
def ==(other)
  other.is_a?(StatusRange) && self.range == other.range
end
Also aliased as: eql?
===(status) click to toggle source
# File lib/webspicy/support/status_range.rb, line 31
def ===(status)
  range === status
end
eql?(other)
Alias for: ==
hash() click to toggle source
# File lib/webspicy/support/status_range.rb, line 40
def hash
  @range.hash
end
inspect()
Alias for: to_s
to_i() click to toggle source
# File lib/webspicy/support/status_range.rb, line 27
def to_i
  @range.first
end
to_int() click to toggle source
# File lib/webspicy/support/status_range.rb, line 14
def to_int
  @range.first
end
to_s() click to toggle source
# File lib/webspicy/support/status_range.rb, line 44
def to_s
  if @range.first == @range.last
    @range.first.to_s
  else
    @range.to_s
  end
end
Also aliased as: inspect
to_str() click to toggle source
# File lib/webspicy/support/status_range.rb, line 23
def to_str
  "#{@range.first/100}xx"
end