Class: Ripper::Lexer::State

Inherits:
Object
  • Object
show all
Defined in:
lib/ripper/lexer.rb

Overview

:stopdoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(i) ⇒ State

Returns a new instance of State.



60
61
62
63
64
# File 'lib/ripper/lexer.rb', line 60

def initialize(i)
  @to_int = i
  @to_s = Ripper.lex_state_name(i)
  freeze
end

Instance Attribute Details

#to_intObject (readonly) Also known as: to_i

Returns the value of attribute to_int.



58
59
60
# File 'lib/ripper/lexer.rb', line 58

def to_int
  @to_int
end

#to_sObject (readonly) Also known as: inspect

Returns the value of attribute to_s.



58
59
60
# File 'lib/ripper/lexer.rb', line 58

def to_s
  @to_s
end

Instance Method Details

#&(i) ⇒ Object



81
# File 'lib/ripper/lexer.rb', line 81

def &(i) self.class.new(to_int & i) end

#==(i) ⇒ Object



80
# File 'lib/ripper/lexer.rb', line 80

def ==(i) super or to_int == i end

#[](index) ⇒ Object



66
67
68
69
70
71
72
73
74
75
# File 'lib/ripper/lexer.rb', line 66

def [](index)
  case index
  when 0, :to_int
    @to_int
  when 1, :to_s
    @event
  else
    nil
  end
end

#allbits?(i) ⇒ Boolean

Returns:

  • (Boolean)


83
# File 'lib/ripper/lexer.rb', line 83

def allbits?(i) to_int.allbits?(i) end

#anybits?(i) ⇒ Boolean

Returns:

  • (Boolean)


84
# File 'lib/ripper/lexer.rb', line 84

def anybits?(i) to_int.anybits?(i) end

#nobits?(i) ⇒ Boolean

Returns:

  • (Boolean)


85
# File 'lib/ripper/lexer.rb', line 85

def nobits?(i) to_int.nobits?(i) end

#pretty_print(q) ⇒ Object



79
# File 'lib/ripper/lexer.rb', line 79

def pretty_print(q) q.text(to_s) end

#|(i) ⇒ Object



82
# File 'lib/ripper/lexer.rb', line 82

def |(i) self.class.new(to_int | i) end