Class: Lisp::String
Instance Attribute Summary
Attributes inherited from Atom
#value
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Atom
#all?, #apply_to, #car, #cdr, #character?, #class?, #copy, #doc, #environment?, #eof_object?, #eq?, #eqv?, #evaluate, #false?, #frame?, #function?, #length, #lisp_object?, #list?, #macro?, #negative?, #number?, #object?, #pair?, #port?, #positive?, #primitive?, #quoted, #set_location, #special?, #symbol?, #true?, #vector?, #zero?
Constructor Details
#initialize(n = '') ⇒ String
Returns a new instance of String.
9
10
11
|
# File 'lib/rubylisp/string.rb', line 9
def initialize(n = '')
@value = n.to_s
end
|
Class Method Details
.with_value(n) ⇒ Object
5
6
7
|
# File 'lib/rubylisp/string.rb', line 5
def self.with_value(n)
self.new(n)
end
|
Instance Method Details
#equal?(other) ⇒ Boolean
21
22
23
|
# File 'lib/rubylisp/string.rb', line 21
def equal?(other)
other.string? && self.value == other.value
end
|
#print_string ⇒ Object
37
38
39
|
# File 'lib/rubylisp/string.rb', line 37
def print_string
"\"#{@value}\""
end
|
13
14
15
|
# File 'lib/rubylisp/string.rb', line 13
def set!(n)
@value = n.to_s
end
|
17
18
19
|
# File 'lib/rubylisp/string.rb', line 17
def string?
true
end
|
29
30
31
|
# File 'lib/rubylisp/string.rb', line 29
def to_s
@value
end
|
33
34
35
|
# File 'lib/rubylisp/string.rb', line 33
def to_sym
@value.to_sym
end
|
25
26
27
|
# File 'lib/rubylisp/string.rb', line 25
def type
:string
end
|