Class: Intersys::Reflection::RelationshipObject

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/reflection.rb

Overview

This is a proxy object to Cache RelationshipObject, which is just like Rails Association object

Instance Method Summary collapse

Methods inherited from Object

#class_name, class_name, common_get_or_set, concurrency, #database, database, delete_all, #destroy, #id, inherited, intersys_description, lookup, prefix, timeout, transaction

Methods included from Callable

#intersys_call, #intersys_get, #intersys_has_method?, #intersys_has_property?, #intersys_method, #intersys_methods, #intersys_properties, #intersys_property, #intersys_reflector, #intersys_set, #method_missing

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Intersys::Callable

Instance Method Details

#<<(object) ⇒ Object Also known as: insert



90
91
92
# File 'lib/reflection.rb', line 90

def <<(object)
  intersys_call("Insert", object)
end

#[](index) ⇒ Object



64
65
66
67
# File 'lib/reflection.rb', line 64

def [](index)
  return @list[index] if @loaded
  intersys_call("GetAt", (index+1).to_s)
end

#countObject Also known as: size



59
60
61
# File 'lib/reflection.rb', line 59

def count
  @count ||= intersys_call("Count")
end

#eachObject



69
70
71
72
73
# File 'lib/reflection.rb', line 69

def each
  0.upto(count-1) do |i|
    yield self[i]
  end
end

#empty?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/reflection.rb', line 55

def empty?
  @empty ||= intersys_call("IsEmpty")
end

#include?(obj) ⇒ Boolean

Returns:

  • (Boolean)


81
82
83
# File 'lib/reflection.rb', line 81

def include?(obj)
  load_list.include?(obj)
end

#inspectObject Also known as: to_s



85
86
87
# File 'lib/reflection.rb', line 85

def inspect
  load_list.inspect
end

#reloadObject



95
96
97
98
99
100
# File 'lib/reflection.rb', line 95

def reload
  @list = nil
  @loaded = nil
  @empty = nil
  @count = nil
end

#to_aObject



77
78
79
# File 'lib/reflection.rb', line 77

def to_a
  load_list
end