Sha256: f2bfa51e5c47e63d21e5fc5b092ba6f9ceb992b75e922b1ebddf1c1194b82ceb

Contents?: true

Size: 620 Bytes

Versions: 1

Compression:

Stored size: 620 Bytes

Contents

module Munson
  module Resource
    def self.included(base)
      base.extend ClassMethods
    end

    module ClassMethods
      def munson
        return @munson if @munson
        @munson = Munson::Agent.new
        @munson
      end
      
      def register_munson_type(name)
        Munson.register_type(name, self)
        self.munson.type = name
      end

      [:includes, :sort, :filter, :fields, :fetch, :find, :page].each do |method|
        class_eval <<-RUBY, __FILE__, __LINE__ + 1
          def #{method}(*args)
            munson.#{method}(*args)
          end
        RUBY
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
munson-0.2.0 lib/munson/resource.rb