Class: Opal::Sexp
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(args) ⇒ Sexp
Returns a new instance of Sexp
8
9
10
|
# File 'opal/lib/opal/parser/sexp.rb', line 8
def initialize(args)
@array = args
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
24
25
26
|
# File 'opal/lib/opal/parser/sexp.rb', line 24
def method_missing(sym, *args, &block)
@array.send sym, *args, &block
end
|
Instance Attribute Details
Returns the value of attribute array
6
7
8
|
# File 'opal/lib/opal/parser/sexp.rb', line 6
def array
@array
end
|
Returns the value of attribute end_line
5
6
7
|
# File 'opal/lib/opal/parser/sexp.rb', line 5
def end_line
@end_line
end
|
Returns the value of attribute line
4
5
6
|
# File 'opal/lib/opal/parser/sexp.rb', line 4
def line
@line
end
|
Instance Method Details
#<<(other) ⇒ Object
28
29
30
31
|
# File 'opal/lib/opal/parser/sexp.rb', line 28
def <<(other)
@array << other
self
end
|
#==(other) ⇒ Object
Also known as:
eql?
46
47
48
49
50
51
52
|
# File 'opal/lib/opal/parser/sexp.rb', line 46
def ==(other)
if other.is_a? Sexp
@array == other.array
else
@array == other
end
end
|
20
21
22
|
# File 'opal/lib/opal/parser/sexp.rb', line 20
def children
@array[1..-1]
end
|
42
43
44
|
# File 'opal/lib/opal/parser/sexp.rb', line 42
def dup
Sexp.new(@array.dup)
end
|
#inspect ⇒ Object
Also known as:
to_s
56
57
58
|
# File 'opal/lib/opal/parser/sexp.rb', line 56
def inspect
"(#{@array.map { |e| e.inspect }.join ' '})"
end
|
#push(*parts) ⇒ Object
33
34
35
36
|
# File 'opal/lib/opal/parser/sexp.rb', line 33
def push(*parts)
@array.push(*parts)
self
end
|
38
39
40
|
# File 'opal/lib/opal/parser/sexp.rb', line 38
def to_ary
@array
end
|
12
13
14
|
# File 'opal/lib/opal/parser/sexp.rb', line 12
def type
@array[0]
end
|
#type=(type) ⇒ Object
16
17
18
|
# File 'opal/lib/opal/parser/sexp.rb', line 16
def type=(type)
@array[0] = type
end
|