Sha256: 627940ea6fa29ebb02a639d3ac54f7c1be8277e14f0abe9865ca45dee1f2344b

Contents?: true

Size: 1.07 KB

Versions: 19

Compression:

Stored size: 1.07 KB

Contents

require "enju_library/engine"
require "enju_library/item"

module EnjuLibrary
  def self.included(base)
    base.extend(ClassMethods)
  end

  module ClassMethods
    def enju_library
      include EnjuLibrary::InstanceMethods
    end
  end

  module InstanceMethods
    private

    def get_library_group
      @library_group = LibraryGroup.site_config
    end

    def get_shelf
      @shelf = Shelf.find(params[:shelf_id], :include => :library) if params[:shelf_id]
    end

    def get_library
      @library = Library.find(params[:library_id]) if params[:library_id]
    end

    def get_libraries
      @libraries = Library.all_cache
    end

    def get_library_group
      @library_group = LibraryGroup.site_config
    end

    def get_bookstore
      @bookstore = Bookstore.find(params[:bookstore_id]) if params[:bookstore_id]
    end

    def get_subscription
      @subscription = Subscription.find(params[:subscription_id]) if params[:subscription_id]
    end
  end
end

ActiveRecord::Base.send :include, EnjuLibrary::LibraryItem
ActionController::Base.send(:include, EnjuLibrary)

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
enju_library-0.1.0.pre30 lib/enju_library.rb
enju_library-0.1.0.pre29 lib/enju_library.rb
enju_library-0.1.0.pre28 lib/enju_library.rb
enju_library-0.1.0.pre27 lib/enju_library.rb
enju_library-0.1.0.pre26 lib/enju_library.rb
enju_library-0.1.0.pre25 lib/enju_library.rb
enju_library-0.1.0.pre24 lib/enju_library.rb
enju_library-0.1.0.pre23 lib/enju_library.rb
enju_library-0.1.0.pre22 lib/enju_library.rb
enju_library-0.1.0.pre21 lib/enju_library.rb
enju_library-0.1.0.pre20 lib/enju_library.rb
enju_library-0.1.0.pre19 lib/enju_library.rb
enju_library-0.1.0.pre18 lib/enju_library.rb
enju_library-0.1.0.pre17 lib/enju_library.rb
enju_library-0.1.0.pre16 lib/enju_library.rb
enju_library-0.1.0.pre15 lib/enju_library.rb
enju_library-0.1.0.pre14 lib/enju_library.rb
enju_library-0.1.0.pre13 lib/enju_library.rb
enju_library-0.1.0.pre12 lib/enju_library.rb