Class: StyleScript::Value
- Inherits:
-
Object
- Object
- StyleScript::Value
- Defined in:
- lib/style_script/value.rb
Overview
Instead of producing raw Ruby objects, the Lexer produces values of this class, wrapping native objects tagged with line number information. Values masquerade as both strings and nodes – being used both as nodes in the AST, and as literally-interpolated values in the generated code.
Instance Attribute Summary collapse
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #[](index) ⇒ Object
- #children ⇒ Object
- #compile(o = {}) ⇒ Object
- #contains? ⇒ Boolean
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(value, line = nil) ⇒ Value
constructor
A new instance of Value.
- #inspect ⇒ Object
- #match(regex) ⇒ Object
- #statement_only? ⇒ Boolean
- #to_str ⇒ Object (also: #to_s)
- #to_sym ⇒ Object
Constructor Details
#initialize(value, line = nil) ⇒ Value
Returns a new instance of Value.
10 11 12 |
# File 'lib/style_script/value.rb', line 10 def initialize(value, line=nil) @value, @line = value, line end |
Instance Attribute Details
#line ⇒ Object (readonly)
Returns the value of attribute line.
8 9 10 |
# File 'lib/style_script/value.rb', line 8 def line @line end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
8 9 10 |
# File 'lib/style_script/value.rb', line 8 def value @value end |
Instance Method Details
#==(other) ⇒ Object
31 32 33 |
# File 'lib/style_script/value.rb', line 31 def ==(other) @value == other end |
#[](index) ⇒ Object
35 36 37 |
# File 'lib/style_script/value.rb', line 35 def [](index) @value[index] end |
#children ⇒ Object
51 52 53 |
# File 'lib/style_script/value.rb', line 51 def children [] end |
#compile(o = {}) ⇒ Object
23 24 25 |
# File 'lib/style_script/value.rb', line 23 def compile(o={}) to_s end |
#contains? ⇒ Boolean
59 60 61 |
# File 'lib/style_script/value.rb', line 59 def contains? false end |
#eql?(other) ⇒ Boolean
39 40 41 |
# File 'lib/style_script/value.rb', line 39 def eql?(other) @value.eql?(other) end |
#hash ⇒ Object
43 44 45 |
# File 'lib/style_script/value.rb', line 43 def hash @value.hash end |
#inspect ⇒ Object
27 28 29 |
# File 'lib/style_script/value.rb', line 27 def inspect @value.inspect end |
#match(regex) ⇒ Object
47 48 49 |
# File 'lib/style_script/value.rb', line 47 def match(regex) @value.match(regex) end |
#statement_only? ⇒ Boolean
55 56 57 |
# File 'lib/style_script/value.rb', line 55 def statement_only? false end |
#to_str ⇒ Object Also known as: to_s
14 15 16 |
# File 'lib/style_script/value.rb', line 14 def to_str @value.to_s end |
#to_sym ⇒ Object
19 20 21 |
# File 'lib/style_script/value.rb', line 19 def to_sym to_str.to_sym end |