Sha256: c5acf6b1968df7926de851813b7ecea84cb32e5f9c2b7acb1760ee132dc40171

Contents?: true

Size: 779 Bytes

Versions: 4

Compression:

Stored size: 779 Bytes

Contents

module CanTango
  module Rails
    module Helpers
      module BaseHelper
        def self.included(base)
          include_apis(base)
          # base.send :include, CanTango::Rails::Helpers::RestHelper
          base.extend ClassMethods
        end

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

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

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
cantango-core-0.1.0 lib/cantango/rails/helpers/base_helper.rb
cantango-0.9.4.7 lib/cantango/rails/helpers/base_helper.rb
cantango-0.9.4.6 lib/cantango/rails/helpers/base_helper.rb
cantango-0.9.4.5 lib/cantango/rails/helpers/base_helper.rb