Class: NScript::Value

Inherits:
Object
  • Object
show all
Defined in:
lib/nscript/value.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, line = nil) ⇒ Value

Returns a new instance of Value.



7
8
9
# File 'lib/nscript/value.rb', line 7

def initialize(value, line=nil)
  @value, @line = value, line
end

Instance Attribute Details

#lineObject (readonly)

Returns the value of attribute line.



5
6
7
# File 'lib/nscript/value.rb', line 5

def line
  @line
end

#valueObject (readonly)

Returns the value of attribute value.



5
6
7
# File 'lib/nscript/value.rb', line 5

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



28
29
30
# File 'lib/nscript/value.rb', line 28

def ==(other)
  @value == other
end

#[](index) ⇒ Object



32
33
34
# File 'lib/nscript/value.rb', line 32

def [](index)
  @value[index]
end

#childrenObject



48
49
50
# File 'lib/nscript/value.rb', line 48

def children
  []
end

#compile(o = {}) ⇒ Object



20
21
22
# File 'lib/nscript/value.rb', line 20

def compile(o={})
  to_s
end

#contains?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/nscript/value.rb', line 56

def contains?
  false
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/nscript/value.rb', line 36

def eql?(other)
  @value.eql?(other)
end

#hashObject



40
41
42
# File 'lib/nscript/value.rb', line 40

def hash
  @value.hash
end

#inspectObject



24
25
26
# File 'lib/nscript/value.rb', line 24

def inspect
  @value.inspect
end

#match(regex) ⇒ Object



44
45
46
# File 'lib/nscript/value.rb', line 44

def match(regex)
  @value.match(regex)
end

#statement_only?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/nscript/value.rb', line 52

def statement_only?
  false
end

#to_strObject Also known as: to_s



11
12
13
# File 'lib/nscript/value.rb', line 11

def to_str
  @value.to_s
end

#to_symObject



16
17
18
# File 'lib/nscript/value.rb', line 16

def to_sym
  to_str.to_sym
end