class Safrano::OData::NavigatedCollection

Public Class Methods

new(childattrib, parent) click to toggle source
Calls superclass method Safrano::OData::Collection::new
# File lib/odata/collection.rb, line 155
def initialize(childattrib, parent)
  childklass = parent.class.nav_collection_attribs[childattrib]

  super(childklass)
  @parent = parent

  set_relation_info(@parent, childattrib)

  @child_method = parent.method(childattrib.to_sym)
  @child_dataset_method = parent.method("#{childattrib}_dataset".to_sym)

  @cx = navigated_dataset
end

Public Instance Methods

all() click to toggle source

redefinitions of the main methods for a navigated collection (eg. all Books of Author is Author.Books.all )

# File lib/odata/collection.rb, line 181
def all
  @child_method.call
end
count() click to toggle source
# File lib/odata/collection.rb, line 185
def count
  @child_method.call.count
end
dataset() click to toggle source
# File lib/odata/collection.rb, line 189
def dataset
  @child_dataset_method.call
end
each() { |enty| ... } click to toggle source
# File lib/odata/collection.rb, line 197
def each
  y = @child_method.call
  y.each { |enty| yield enty }
end
initialize_dataset(dtset = nil) click to toggle source
# File lib/odata/collection.rb, line 175
def initialize_dataset(dtset = nil)
  @cx = @cx || dtset || navigated_dataset
end
navigated_dataset() click to toggle source
odata_post(req) click to toggle source
# File lib/odata/collection.rb, line 169
def odata_post(req)
  @modelk.odata_create_entity_and_relation(req,
                                           @navattr_reflection,
                                           @nav_parent)
end
to_a() click to toggle source
# File lib/odata/collection.rb, line 202
def to_a
  y = @child_method.call
  y.to_a
end