Class: Infoblocks::Display

Inherits:
Object
  • Object
show all
Defined in:
lib/infoblocks/display.rb

Class Method Summary collapse

Class Method Details

.disp(obj = nil) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/infoblocks/display.rb', line 5

def self.disp(obj=nil)
  template_path = File.expand_path("templates/#{obj.class.to_s.split(':').last.downcase}.erb", File.dirname(__FILE__))

  if File.exists?(template_path)
    template = ERB.new(IO.read(template_path), nil, '-') 
    puts template(obj).result obj.instance_eval('binding')
  else
    puts obj._ref
  end
end