Class: Writefully::Taxon::EagerLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/writefully/taxon.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ EagerLoader

Returns a new instance of EagerLoader.



39
40
41
42
43
# File 'lib/writefully/taxon.rb', line 39

def initialize(klass)
  @tags      = Tag.arel_table
  @taggings  = Tagging.arel_table
  @resource  = klass.arel_table
end

Instance Attribute Details

#resourceObject (readonly)

Returns the value of attribute resource.



37
38
39
# File 'lib/writefully/taxon.rb', line 37

def resource
  @resource
end

#taggingsObject (readonly)

Returns the value of attribute taggings.



37
38
39
# File 'lib/writefully/taxon.rb', line 37

def taggings
  @taggings
end

#tagsObject (readonly)

Returns the value of attribute tags.



37
38
39
# File 'lib/writefully/taxon.rb', line 37

def tags
  @tags
end

Instance Method Details

#build(*types) ⇒ Object



45
46
47
# File 'lib/writefully/taxon.rb', line 45

def build *types
  [resource[Arel.star]] << types.map { |type| array_of_taxonomy_hstores_for(type) }
end