Sha256: 56532169c8ce3121e319f377434916012a269f049901b1362a54f5814bb7716e

Contents?: true

Size: 393 Bytes

Versions: 7

Compression:

Stored size: 393 Bytes

Contents

class SmallCage::ErbBase
  def initialize(loader, renderer, obj)
    @loader, @renderer, @obj = loader, renderer, obj
  end

  def method_missing(name)
    n = name.to_s
    
    return @obj[n] unless @obj[n].nil?
    return @obj["strings"][0] if n == "body" && ! @obj["strings"][0].nil?

    # render if template file exists. or return nil.
    return @renderer.render(name, @obj)
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
bluemark-smallcage-0.1.3 lib/smallcage/erb_base.rb
smallcage-0.1.2 lib/smallcage/erb_base.rb
smallcage-0.0.9 lib/smallcage/erb_base.rb
smallcage-0.1.0 lib/smallcage/erb_base.rb
smallcage-0.0.8 lib/smallcage/erb_base.rb
smallcage-0.1.1 lib/smallcage/erb_base.rb
smallcage-0.1.3 lib/smallcage/erb_base.rb