Class: Object

Inherits:
BasicObject
Defined in:
lib/rfm/utilities/core_ext.rb

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Object) meta_attr_accessor(*names)

Adds methods to put instance variables in rfm_metaclass, plus getter/setters This is useful to hide instance variables in objects that would otherwise show "too much" information.



14
15
16
17
# File 'lib/rfm/utilities/core_ext.rb', line 14

def self.meta_attr_accessor(*names)
meta_attr_reader(*names)
meta_attr_writer(*names)
end

+ (Object) meta_attr_reader(*names)



19
20
21
22
23
# File 'lib/rfm/utilities/core_ext.rb', line 19

def self.meta_attr_reader(*names)
  names.each do |n|
    define_method(n.to_s) {rfm_metaclass.instance_variable_get("@#{n}")}
  end
end

+ (Object) meta_attr_writer(*names)



25
26
27
28
29
# File 'lib/rfm/utilities/core_ext.rb', line 25

def self.meta_attr_writer(*names)
  names.each do |n|
    define_method(n.to_s + "=") {|val| rfm_metaclass.instance_variable_set("@#{n}", val)}
  end
end

Instance Method Details

- (Object) local_methods

Just testing this functionality



39
40
41
# File 'lib/rfm/utilities/core_ext.rb', line 39

def local_methods
	self.methods - self.class.superclass.methods
end

- (Object) rfm_force_array

since XmlMini doesn't know which will be returnd for any particular element. See Rfm Layout & Record where this is used.



34
35
36
# File 'lib/rfm/utilities/core_ext.rb', line 34

def rfm_force_array
	self.is_a?(Array) ? self : [self]
end