Class: Intersys::Reflection::ClassDefinition

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

Overview

This class is basic reflection class If has class method Open(class_name), that creates instance of this class, representing its internals

Usually creates via Intersys::Object.reflector

Then it is possible to call such methods as _methods, properties to get access to methods and properties of Cache class

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

#_methodsObject

short alias to intersys_get(“Methods”)



23
24
25
# File 'lib/reflection.rb', line 23

def _methods
  @methods ||= intersys_get("Methods")
end

#all_methodsObject



31
32
33
34
35
36
37
38
39
# File 'lib/reflection.rb', line 31

def all_methods
  _methods.to_a + self.super.split(",").map do |klass|
    klass = klass.strip
    if match_data = klass.match(/^%([^\.]+)$/)
      klass = "%Library.#{match_data.captures.first}"
    end
    self.class.open(klass).all_methods
  end.flatten
end

#propertiesObject



27
28
29
# File 'lib/reflection.rb', line 27

def properties
  @properties ||= intersys_get("Properties")
end

#saveObject

After all changes to class definition required to call save



18
19
20
# File 'lib/reflection.rb', line 18

def save
  intersys_call("%Save")
end