Class: CodeMiner::DynamicStringExpression
- Inherits:
-
Expression
- Object
- Expression
- CodeMiner::DynamicStringExpression
- Defined in:
- lib/codeminer/expressions/dynamic_string_expression.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from Expression
#args, #block, #delimiter, #src, #token
Class Method Summary collapse
Instance Method Summary collapse
- #add(string, src = string.src_extract) ⇒ Object
- #each ⇒ Object
-
#initialize(*body, src) ⇒ DynamicStringExpression
constructor
A new instance of DynamicStringExpression.
- #type ⇒ Object
Methods inherited from Expression
Methods included from SourceExtract::Usage
#adjust_src, #column, #column=, #end_column, #end_column=, #end_line, #end_line=, #line, #line=, #src, #src_extract
Constructor Details
#initialize(*body, src) ⇒ DynamicStringExpression
Returns a new instance of DynamicStringExpression.
15 16 17 18 |
# File 'lib/codeminer/expressions/dynamic_string_expression.rb', line 15 def initialize(*body, src) @src = src @body = body end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
13 14 15 |
# File 'lib/codeminer/expressions/dynamic_string_expression.rb', line 13 def value @value end |
Class Method Details
.wrap(exp) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/codeminer/expressions/dynamic_string_expression.rb', line 5 def self.wrap(exp) if exp.type == :dynamic_string exp else new(exp, exp.src_extract) end end |
Instance Method Details
#add(string, src = string.src_extract) ⇒ Object
28 29 30 31 32 |
# File 'lib/codeminer/expressions/dynamic_string_expression.rb', line 28 def add(string, src=string.src_extract) @body << string adjust_src(src) self end |
#each ⇒ Object
24 25 26 |
# File 'lib/codeminer/expressions/dynamic_string_expression.rb', line 24 def each @body end |
#type ⇒ Object
20 21 22 |
# File 'lib/codeminer/expressions/dynamic_string_expression.rb', line 20 def type :dynamic_string end |