Sha256: 2483b7507f6f3e62b42615bb637da7a4c6356b93b57ca50a2ca2011c0b713980

Contents?: true

Size: 638 Bytes

Versions: 29

Compression:

Stored size: 638 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.dup) # rubocop:disable Style/RedundantSelf
        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

29 entries across 29 versions & 1 rubygems

Version Path
lhs-4.2.1 lib/lhs/concerns/record/includes.rb
lhs-4.2.0 lib/lhs/concerns/record/includes.rb
lhs-4.1.0 lib/lhs/concerns/record/includes.rb
lhs-4.0.0 lib/lhs/concerns/record/includes.rb
lhs-3.4.2 lib/lhs/concerns/record/includes.rb
lhs-3.4.1 lib/lhs/concerns/record/includes.rb
lhs-3.4.0 lib/lhs/concerns/record/includes.rb
lhs-3.3.6 lib/lhs/concerns/record/includes.rb
lhs-3.3.5 lib/lhs/concerns/record/includes.rb