Class: Reak::Syntax::Literal
- Inherits:
-
Node
show all
- Defined in:
- lib/reak/syntax/literal.rb
Instance Attribute Summary (collapse)
Class Method Summary
(collapse)
Instance Method Summary
(collapse)
Methods inherited from Node
#graph, #nested_unclosure, #pretty_print, unfold, #unfold?
Constructor Details
- (Literal) initialize(value)
A new instance of Literal
36
37
38
|
# File 'lib/reak/syntax/literal.rb', line 36
def initialize(value)
@value = value
end
|
Instance Attribute Details
Returns the value of attribute value
4
5
6
|
# File 'lib/reak/syntax/literal.rb', line 4
def value
@value
end
|
Class Method Details
+ (Object) reuse(multiple = false)
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/reak/syntax/literal.rb', line 7
def self.reuse(multiple = false)
if multiple
@reuse = {}
def self.new(arg)
@reuse[arg] ||= super
end
else
def self.new
@singleton ||= super
end
end
end
|
Instance Method Details
28
29
30
|
# File 'lib/reak/syntax/literal.rb', line 28
def to_f
value.to_f
end
|
20
21
22
|
# File 'lib/reak/syntax/literal.rb', line 20
def to_i
value.to_i
end
|
24
25
26
|
# File 'lib/reak/syntax/literal.rb', line 24
def to_s
value.to_s
end
|
40
41
42
|
# File 'lib/reak/syntax/literal.rb', line 40
def to_sexp
[:lit, @value]
end
|
32
33
34
|
# File 'lib/reak/syntax/literal.rb', line 32
def to_sym
value.to_sym
end
|
- (Object) unclosure
48
49
50
|
# File 'lib/reak/syntax/literal.rb', line 48
def unclosure
self
end
|
- (Object) visit(visitor)
44
45
46
|
# File 'lib/reak/syntax/literal.rb', line 44
def visit(visitor)
visitor.literal self
end
|