Class: Relation

Inherits:
Object
  • Object
show all
Defined in:
lib/redisant/relations.rb

Direct Known Subclasses

BelongsTo, HasMany

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, object) ⇒ Relation

Returns a new instance of Relation.



4
5
6
7
8
# File 'lib/redisant/relations.rb', line 4

def initialize name, object
  @name = name.to_s
  @object = object
  @class = Inflector.constantize Inflector.singularize(name)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



2
3
4
# File 'lib/redisant/relations.rb', line 2

def name
  @name
end

#objectObject (readonly)

Returns the value of attribute object.



2
3
4
# File 'lib/redisant/relations.rb', line 2

def object
  @object
end

Instance Method Details

#object_classObject



10
11
12
# File 'lib/redisant/relations.rb', line 10

def object_class
  @class
end