Class: Contraction::Parser::Type

Inherits:
Object
  • Object
show all
Defined in:
lib/parser/type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(part) ⇒ Type

Returns a new instance of Type.



5
6
7
# File 'lib/parser/type.rb', line 5

def initialize(part)
  parse(part)
end

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



4
5
6
# File 'lib/parser/type.rb', line 4

def type
  @type
end

Instance Method Details

#check(thing) ⇒ Object

Checks weather or not thing is a given type.



10
11
12
13
# File 'lib/parser/type.rb', line 10

def check(thing)
  return true unless type
  type.check thing
end