Sha256: fe434276a4efcd25852c5416a7e910d303b108379915b2605fe1912ec4e43c09

Contents?: true

Size: 596 Bytes

Versions: 7

Compression:

Stored size: 596 Bytes

Contents

require 'active_support'

class LHS::Record

  module Includes
    extend ActiveSupport::Concern

    module ClassMethods
      def including
        @including
      end

      def including=(including)
        @including = including
      end

      def includes(*args)
        name = "#{self}#{args.object_id}"
        constant = Object.const_set(name.demodulize, self)
        class_clone = constant
        class_clone.endpoints = endpoints
        class_clone.mapping = mapping
        class_clone.including = args.size == 1 ? args[0] : args
        class_clone
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lhs-3.3.3 lib/lhs/concerns/record/includes.rb
lhs-3.3.2 lib/lhs/concerns/record/includes.rb
lhs-3.3.1 lib/lhs/concerns/record/includes.rb
lhs-3.3.0 lib/lhs/concerns/record/includes.rb
lhs-3.2.0 lib/lhs/concerns/record/includes.rb
lhs-3.1.3 lib/lhs/concerns/record/includes.rb
lhs-3.1.1 lib/lhs/concerns/record/includes.rb