Module: DataModelViews

Included in:
NodeElementOperations
Defined in:
lib/midas/node_element_operations.rb

Constant Summary collapse

OpIdToViewType =
{
    :static_ops => :value_match,
    :replace_ops => :value_match,
    :list_ops => :included_match,
    :key_list_ops => :key_of_included_match
}

Instance Method Summary collapse

Instance Method Details

#default_views(field_op_set) ⇒ Object

views return a list of matches (which may be empty)



176
177
178
179
180
181
182
183
184
# File 'lib/midas/node_element_operations.rb', line 176

def default_views(field_op_set)
  views = {}
  field_op_set.each do |field, op_id|
    view_name = "by_#{field.to_s}"
    type_of_view = OpIdToViewType[op_id] || :value_match
    views[view_name] = {:field => field.to_sym, :type_of_view => type_of_view}
  end
  views
end