is an object # that encapsulates logic for a particular template. # # It's often instantiated with one or more domain objects and # it's goal is to minimize/remove logic from templates. It holds # a reference to current view context in order to use rails helper methods # # See: http://martinfowler.com/eaaDev/PresentationModel.html class Presenter attr_reader :view_context def initialize(attributes = {}, options = {}) @view_context = options.fetch(:view_context) { ViewContext.current } @attributes = attributes end def method_missing(name, *args, &block) if @attributes.has_key?(name) @attributes[name] else super end end end