Class: Rbml::Shell

Inherits:
Base
  • Object
show all
Defined in:
lib/shell.rb

Instance Attribute Summary

Attributes inherited from Base

#dsl

Class Method Summary collapse

Methods inherited from Base

#initialize, #instance_eval_each

Constructor Details

This class inherits a constructor from Rbml::Base

Class Method Details

.render(language, options, &block) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/shell.rb', line 3

def self.render(language, options, &block)
  d = Shell.new(language)
  puts options
  display = lambda do |result|
    if result.kind_of? Array
      result.each {|r| r.kind_of?(Proc) ? d.instance_eval_each(r, &display) : puts(r) }
    else
      puts result unless result.nil?
    end
  end
  d.instance_eval_each(block, &display)
end