Sha256: e429a558e2bc0cab411b6fa0b9aac9a90ea61d95cb91109bb36ebe38b647fb26

Contents?: true

Size: 794 Bytes

Versions: 1

Compression:

Stored size: 794 Bytes

Contents

module Troles
  module Api
    module ClassMethods      
      #
      # When the Troles::Api is included by the Role Subject class (fx a User Account)
      # first include methods from Troles Common API      
      # then include Troles API on top
      #
      # @param [Class] the role subject class (fx User or UserAccount)
      #
      def included(base)
        base.send :include, Troles::Common::Api
        self.extend Troles::Common::Api::ClassMethods # draws in the #apis method from Common Api
        apis.each do |api|
          begin
            base.send :include, "Troles::Api::#{api.to_s.camelize}".constantize
            base.extend "Troles::Api::#{api.to_s.camelize}::ClassMethods".constantize
          rescue
          end
        end
      end      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
troles-0.6.1 lib/troles/api/class_methods.rb