Class: Sith::MacroMapper
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#delimiter ⇒ Object
readonly
Returns the value of attribute delimiter.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
Instance Method Summary collapse
- #expand_to_source(nodes) ⇒ Object
-
#initialize(label, delimiter = "\n", body = '') ⇒ MacroMapper
constructor
A new instance of MacroMapper.
Methods inherited from BaseMacro
Constructor Details
#initialize(label, delimiter = "\n", body = '') ⇒ MacroMapper
Returns a new instance of MacroMapper.
55 56 57 58 59 |
# File 'lib/sith/macro.rb', line 55 def initialize(label, delimiter="\n", body='') @label = label @delimiter = delimiter @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
53 54 55 |
# File 'lib/sith/macro.rb', line 53 def body @body end |
#delimiter ⇒ Object (readonly)
Returns the value of attribute delimiter.
53 54 55 |
# File 'lib/sith/macro.rb', line 53 def delimiter @delimiter end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
53 54 55 |
# File 'lib/sith/macro.rb', line 53 def label @label end |
Instance Method Details
#expand_to_source(nodes) ⇒ Object
61 62 63 64 |
# File 'lib/sith/macro.rb', line 61 def (nodes) macros = nodes.map { |n| Macro.new([label], false, @body)} macros.map { |m| m.(nodes) }.join(delimiter) end |