Sha256: 24147e1346c52d10602eca9490edc99e8c9f668ea30b996be8ef605bf8576023

Contents?: true

Size: 584 Bytes

Versions: 1

Compression:

Stored size: 584 Bytes

Contents

module CanTango
  module Rails
    module BaseHelpers
      def self.included(base)
        include_apis(base)
        base.extend ClassMethods
      end

      module ClassMethods
        def include_apis(clazz)
          return if !respond_to?(:apis) || !apis
          apis.each do |api|
            clazz.send :include, "CanTango::Api::User::#{api}".constantize
            clazz.send :include, "CanTango::Api::UserAccount::#{api}".constantize
          end
        end

        def apis
          [:Can, :Scope]
        end
      end
      extend ClassMethods
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cantango-0.8.0 lib/cantango/rails/base_helpers.rb