Class: SequelMapper::RelationMapping

Inherits:
Object
  • Object
show all
Defined in:
lib/sequel_mapper/relation_mapping.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, namespace:, fields:, primary_key:, factory:, serializer:, associations:, subsets:) ⇒ RelationMapping

Returns a new instance of RelationMapping.



3
4
5
6
7
8
9
10
11
12
# File 'lib/sequel_mapper/relation_mapping.rb', line 3

def initialize(name:, namespace:, fields:, primary_key:, factory:, serializer:, associations:, subsets:)
  @name = name
  @namespace = namespace
  @fields = fields
  @primary_key = primary_key
  @factory = factory
  @serializer = serializer
  @associations = associations
  @subsets = subsets
end

Instance Attribute Details

#associationsObject (readonly)

Returns the value of attribute associations.



14
15
16
# File 'lib/sequel_mapper/relation_mapping.rb', line 14

def associations
  @associations
end

#factoryObject (readonly)

Returns the value of attribute factory.



14
15
16
# File 'lib/sequel_mapper/relation_mapping.rb', line 14

def factory
  @factory
end

#fieldsObject (readonly)

Returns the value of attribute fields.



14
15
16
# File 'lib/sequel_mapper/relation_mapping.rb', line 14

def fields
  @fields
end

#nameObject (readonly)

Returns the value of attribute name.



14
15
16
# File 'lib/sequel_mapper/relation_mapping.rb', line 14

def name
  @name
end

#namespaceObject (readonly)

Returns the value of attribute namespace.



14
15
16
# File 'lib/sequel_mapper/relation_mapping.rb', line 14

def namespace
  @namespace
end

#primary_keyObject (readonly)

Returns the value of attribute primary_key.



14
15
16
# File 'lib/sequel_mapper/relation_mapping.rb', line 14

def primary_key
  @primary_key
end

#serializerObject (readonly)

Returns the value of attribute serializer.



14
15
16
# File 'lib/sequel_mapper/relation_mapping.rb', line 14

def serializer
  @serializer
end

#subsetsObject (readonly)

Returns the value of attribute subsets.



14
15
16
# File 'lib/sequel_mapper/relation_mapping.rb', line 14

def subsets
  @subsets
end

Instance Method Details

#add_association(name, new_association) ⇒ Object



16
17
18
# File 'lib/sequel_mapper/relation_mapping.rb', line 16

def add_association(name, new_association)
  @associations = associations.merge(name => new_association)
end