Class: Walrus::WalrusGrammar::RubyDirective
- Inherits:
-
Object
- Object
- Walrus::WalrusGrammar::RubyDirective
- Defined in:
- lib/walrus/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
17 18 19 20 21 22 23 |
# File 'lib/walrus/walrus_grammar/ruby_directive.rb', line 17 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 |