module Tripod::Embeds::ClassMethods

Public Instance Methods

embeds(name, predicate, opts={}) click to toggle source
# File lib/tripod/embeds.rb, line 21
def embeds(name, predicate, opts={})
  re_define_method name do
    get_embeds(name, predicate, opts)
  end

  # use this as a way to get to all the embedded properties for validation
  @_EMBEDDED ||= []
  @_EMBEDDED << name

  # add statements to our hydrate query so the repository is populated appropriately
  append_to_hydrate_construct ->(u) { "#{ u } <#{ predicate.to_s }> ?es . ?es ?ep ?eo ." }
  append_to_hydrate_where ->(u) { "OPTIONAL { #{ u } <#{ predicate.to_s }> ?es . ?es ?ep ?eo . }" }
end
get_embedded() click to toggle source
# File lib/tripod/embeds.rb, line 35
def get_embedded
  @_EMBEDDED || []
end