Sha256: ee048fe833dfd2a0160360167ce5f1800e3971745353aa1c3b5ae14306988a25
Contents?: true
Size: 719 Bytes
Versions: 25
Compression:
Stored size: 719 Bytes
Contents
class Refinery::BasePresenter DEFAULT_FIELDS = { :title => Proc.new { |p| p.model.present? ? p.model.class.name.titleize : nil }, :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
25 entries across 25 versions & 1 rubygems