Sha256: 498d96f2680071146d08145b70b144479aaa3558aba6730f6a3a065ef1994b25

Contents?: true

Size: 520 Bytes

Versions: 12

Compression:

Stored size: 520 Bytes

Contents

module PushType
  module Presentable
    extend ActiveSupport::Concern

    def presenter_class
      self.class.presenter_class
    end

    def present!(context = nil)
      presenter_class.new(self, context)
    end

    module ClassMethods

      def presenter_class_name
        "#{ name }Presenter"
      end

      def presenter_class
        Object.const_get presenter_class_name
      rescue NameError
        Object.const_set presenter_class_name, Class.new(PushType::Presenter)
      end

    end

  end  
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
push_type_core-0.5.3 app/models/concerns/push_type/presentable.rb
push_type_core-0.5.2 app/models/concerns/push_type/presentable.rb
push_type_core-0.5.1 app/models/concerns/push_type/presentable.rb
push_type_core-0.5.0 app/models/concerns/push_type/presentable.rb
push_type_core-0.5.0.alpha.5 app/models/concerns/push_type/presentable.rb
push_type_core-0.5.0.alpha.4 app/models/concerns/push_type/presentable.rb
push_type_core-0.5.0.alpha.3 app/models/concerns/push_type/presentable.rb
push_type_core-0.5.0.alpha.2 app/models/concerns/push_type/presentable.rb
push_type_core-0.5.0.alpha.1 app/models/concerns/push_type/presentable.rb
push_type_core-0.4.0 app/models/concerns/push_type/presentable.rb
push_type_core-0.4.0.beta.3 app/models/concerns/push_type/presentable.rb
push_type_core-0.3.3 app/models/concerns/push_type/presentable.rb