lib/skemata/node.rb
#
# If a schema entry is passed a block, extract the child's root_object
# attribute and draw a new node. Attempts to infer the attribute name.
#
# The token is the schema definition key (e.g. a function invocation),
# the type is the schema.org object type, and the last key is the explicit
# attribute on the current node's root object. If only the token is
# provided, or if both the token and the type are provided, we try to
# extract an attribute with either of those names before falling back to
# null.
#
# @param token [String] Invoked method name in DSL.draw block body
# @param *args [Array] Contains [type, token]
# @param &block [Block] The DSL definition of the child object
#
# @return [Hash] A copy of the data hash as returned by Hash#merge!
If a schema entry is passed a block, extract the child's root_object
attribute and draw a new node. Attempts to infer the attribute name.

The token is the schema definition key ,
the type is the schema.org object type, and the last key is the explicit
attribute on the current node's root object. If only the token is
provided, or if both the token and the type are provided, we try to
extract an attribute with either of those names before falling back to
null.
If a schema entry is passed a block extract the child ' s root_object attribute and draw a new node . Attempts to infer the attribute name . The token is the schema definition key the type is the schema . org object type and the last key is the explicit attribute on the current node ' s root object . If only the token is provided or if both the token and the type are provided we try to extract an attribute with either of those names before falling back to null .
def route_block(token, *args, &block)
      type, prop = args.shift(2)
      child_root = extract(prop) if prop.is_a?(Symbol)
      child_root = extract(token.titleize.to_sym) if type.nil? && prop.nil?
      child_root = find_property(token, type) unless child_root.present?
      internal_draw(token, type, child_root, &block)
    end
def route_block ( token , * args , & block ) type , prop = args . shift ( 2 ) child_root = extract ( prop ) if prop . is_a? ( Symbol ) child_root = extract ( token . titleize . to_sym ) if type . nil? && prop . nil? child_root = find_property ( token , type ) unless child_root . present? internal_draw ( token , type , child_root , & block ) end
If a schema entry is passed a block, extract the child's root_object
attribute and draw a new node.
If a schema entry is passed a block extract the child ' s root_object attribute and draw a new node .
# Explicitly defined property # Hash key / token is type # If we still have no data, fold to the first present # property by using token and type as keys
A copy of the data hash as returned by Hash#merge!
A copy of the data hash as returned by Hash#merge!
Hash
token
Invoked method name in DSL.draw block body
Invoked method name in DSL . draw block body
args
block
*args
Contains [type, token]
Contains [ type token ]
&block
The DSL definition of the child object
The DSL definition of the child object