Module: Enumeration::InstanceMethods

Defined in:
lib/zkruby/enum.rb

Instance Method Summary collapse

Instance Method Details

#&(num) ⇒ Object



38
39
40
# File 'lib/zkruby/enum.rb', line 38

def &(num)
    to_int & num
end

#===(other) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/zkruby/enum.rb', line 15

def === (other)
    case other
    when Symbol
        to_sym == other
    when Fixnum
        to_int == other
    else
        super
    end
end

#to_iObject



26
27
28
# File 'lib/zkruby/enum.rb', line 26

def to_i
    to_int
end

#to_intObject



30
31
32
# File 'lib/zkruby/enum.rb', line 30

def to_int
    @index
end

#to_sObject



46
47
48
# File 'lib/zkruby/enum.rb', line 46

def to_s
    "#{super} (:#{@name} [#{@index}])"
end

#to_symObject



42
43
44
# File 'lib/zkruby/enum.rb', line 42

def to_sym
    @name
end

#|(num) ⇒ Object



34
35
36
# File 'lib/zkruby/enum.rb', line 34

def |(num)
    to_int | num
end