Module: LHS::Record::Includes::ClassMethods

Defined in:
lib/lhs/concerns/record/includes.rb

Instance Method Summary collapse

Instance Method Details

#includes(*args) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/lhs/concerns/record/includes.rb', line 17

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

#includingObject



9
10
11
# File 'lib/lhs/concerns/record/includes.rb', line 9

def including
  @including
end

#including=(including) ⇒ Object



13
14
15
# File 'lib/lhs/concerns/record/includes.rb', line 13

def including=(including)
  @including = including
end