Sha256: 7e589d08e600fd47db0d7b1070f504e5dd1f7f60b9e8bf72d259611d687b8968

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

require 'kaminari'

require 'puffer/extensions/activerecord'
require 'puffer/extensions/controller'
require 'puffer/extensions/core'
require 'puffer/extensions/mapper'
require 'puffer/extensions/form'
require 'puffer/extensions/engine'
require 'puffer/engine'

module Puffer
  
  module Component
    autoload :Base, 'puffer/component'

    mattr_accessor :_mappings
    self._mappings = {}

    def self.map_component *args
      to = args.extract_options![:to]
      args.each { |type| _mappings[type.to_sym] = to }
    end

    def self.component_for type
      (_mappings[type.to_sym] || "#{type}_component").to_s.camelize.constantize
    end

    map_component :belongs_to, :has_one, :to => :ReferencesOneComponent
    map_component :has_many, :has_and_belongs_to_many, :to => :ReferencesManyComponent
    map_component :date, :time, :datetime, :timestamp, :to => :DateTimeComponent
    map_component :integer, :decimal, :to => :StringComponent
  end

  module Controller
    autoload :Action, 'puffer/controller/actions'
    autoload :MemberAction, 'puffer/controller/actions'
    autoload :CollectionAction, 'puffer/controller/actions'
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
puffer-0.0.26 lib/puffer.rb