Sha256: 152f44621a724162a007f560984263df985e29d70759d97ab46573455c5cff11

Contents?: true

Size: 585 Bytes

Versions: 6

Compression:

Stored size: 585 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, 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

6 entries across 6 versions & 1 rubygems

Version Path
lhs-3.1.0 lib/lhs/concerns/record/includes.rb
lhs-3.0.5 lib/lhs/concerns/record/includes.rb
lhs-3.0.4 lib/lhs/concerns/record/includes.rb
lhs-3.0.3 lib/lhs/concerns/record/includes.rb
lhs-3.0.2 lib/lhs/concerns/record/includes.rb
lhs-3.0.1 lib/lhs/concerns/record/includes.rb