Module: Shared::DataAttributes

Extended by:
ActiveSupport::Concern
Included in:
CollectionObject, Otu, Source
Defined in:
app/models/concerns/shared/data_attributes.rb

Instance Method Summary collapse

Instance Method Details

#has_data_attributes?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'app/models/concerns/shared/data_attributes.rb', line 9

def has_data_attributes?
  self.data_attributes.count > 0
end

#keyword_value_hashObject



13
14
15
16
17
18
19
20
21
# File 'app/models/concerns/shared/data_attributes.rb', line 13

def keyword_value_hash
  self.data_attributes.inject({}) do |hsh, a|   
    if a.class == ImportAttribute
      hsh.merge!(a.import_predicate => a.value)
    else # there are only two
      hsh.merge!(a.predicate.name => a.value)
    end
  end 
end