Class: Walrus::Grammar::RubyDirective
- Inherits:
-
Directive
- Object
- Directive
- Walrus::Grammar::RubyDirective
- Defined in:
- lib/walrus/grammar/ruby_directive.rb
Instance Method Summary collapse
-
#compile(options = {}) ⇒ Object
TODO: could make a #rubyecho method that did an “accumulate do” instead of instance_eval.
Instance Method Details
#compile(options = {}) ⇒ Object
TODO: could make a #rubyecho method that did an “accumulate do” instead of instance_eval
30 31 32 33 34 35 36 37 38 |
# File 'lib/walrus/grammar/ruby_directive.rb', line 30 def compile = {} # possible problem here is that the compiler will indent each line for # us, possibly breaking here docs etc # seeing as it is going to be indented anyway, I add some additional # indenting here for pretty printing purposes compiled = "instance_eval do # Ruby directive\n" @content.to_s.each { |line| compiled << ' ' + line } compiled << "end\n" end |