Sha256: ae7c1b8130187a37342e51e928ec7b0c6a615b3c1c4ae611bf287185ecf4fa3f
Contents?: true
Size: 716 Bytes
Versions: 10
Compression:
Stored size: 716 Bytes
Contents
class Refinery::BasePresenter DEFAULT_FIELDS = { :title => Proc.new { |p| (p.model.class.name.titleize if p.model.present?) }, :path => Proc.new { |p| p.title }, :browser_title => nil, :meta_description => nil, :meta_keywords => nil } attr_reader :model def initialize(obj) @model = obj end def method_missing(method, *args) if @model.respond_to? method @model.send method elsif DEFAULT_FIELDS.has_key? method (value = DEFAULT_FIELDS[method]).is_a?(Proc) ? value.call(self) : value else raise NoMethodError.new("#{self.class.name} doesn't know #{method}. Define or delegate it.", method) end end end
Version data entries
10 entries across 10 versions & 2 rubygems