Class: DataWorks::NecessaryParent

Inherits:
Object
  • Object
show all
Defined in:
lib/data_works/necessary_parent.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entry) ⇒ NecessaryParent

Returns a new instance of NecessaryParent.



17
18
19
20
21
22
23
24
# File 'lib/data_works/necessary_parent.rb', line 17

def initialize(entry)
  if entry.is_a? Hash
    @association_name = entry.keys.first
    @model_name  = entry.values.first
  else
    @association_name = @model_name = entry
  end
end

Instance Attribute Details

#association_nameObject (readonly)

Returns the value of attribute association_name.



15
16
17
# File 'lib/data_works/necessary_parent.rb', line 15

def association_name
  @association_name
end

#model_nameObject (readonly)

Returns the value of attribute model_name.



15
16
17
# File 'lib/data_works/necessary_parent.rb', line 15

def model_name
  @model_name
end