Class: Kapusta::Sym
- Inherits:
-
Object
show all
- Defined in:
- lib/kapusta/ast.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(name) ⇒ Sym
Returns a new instance of Sym.
18
19
20
|
# File 'lib/kapusta/ast.rb', line 18
def initialize(name)
@name = name.to_s
end
|
Instance Attribute Details
#column ⇒ Object
Returns the value of attribute column.
16
17
18
|
# File 'lib/kapusta/ast.rb', line 16
def column
@column
end
|
#line ⇒ Object
Returns the value of attribute line.
16
17
18
|
# File 'lib/kapusta/ast.rb', line 16
def line
@line
end
|
#name ⇒ Object
Returns the value of attribute name.
15
16
17
|
# File 'lib/kapusta/ast.rb', line 15
def name
@name
end
|
Instance Method Details
#==(other) ⇒ Object
Also known as:
eql?
30
31
32
|
# File 'lib/kapusta/ast.rb', line 30
def ==(other)
other.instance_of?(self.class) && other.name == @name
end
|
#binding_key ⇒ Object
39
40
41
|
# File 'lib/kapusta/ast.rb', line 39
def binding_key
@name
end
|
#dotted? ⇒ Boolean
43
44
45
|
# File 'lib/kapusta/ast.rb', line 43
def dotted?
@name != '.' && @name.include?('.')
end
|
#hash ⇒ Object
35
36
37
|
# File 'lib/kapusta/ast.rb', line 35
def hash
[self.class, @name].hash
end
|
#inspect ⇒ Object
26
27
28
|
# File 'lib/kapusta/ast.rb', line 26
def inspect
@name.to_s
end
|
#segments ⇒ Object
47
48
49
|
# File 'lib/kapusta/ast.rb', line 47
def segments
@name.split('.')
end
|
#to_s ⇒ Object
22
23
24
|
# File 'lib/kapusta/ast.rb', line 22
def to_s
@name
end
|