Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/rfm/utilities/core_ext.rb
Class Method Summary collapse
-
.meta_attr_accessor(*names) ⇒ Object
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.
- .meta_attr_reader(*names) ⇒ Object
- .meta_attr_writer(*names) ⇒ Object
Instance Method Summary collapse
-
#rfm_force_array ⇒ Object
since XmlMini doesn’t know which will be returnd for any particular element.
-
#rfm_local_methods ⇒ Object
Just testing this functionality.
Class Method Details
.meta_attr_accessor(*names) ⇒ Object
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.(*names) (*names) (*names) end |
.meta_attr_reader(*names) ⇒ Object
19 20 21 22 23 |
# File 'lib/rfm/utilities/core_ext.rb', line 19 def self.(*names) names.each do |n| define_method(n.to_s) {.instance_variable_get("@#{n}")} end end |
.meta_attr_writer(*names) ⇒ Object
25 26 27 28 29 |
# File 'lib/rfm/utilities/core_ext.rb', line 25 def self.(*names) names.each do |n| define_method(n.to_s + "=") {|val| .instance_variable_set("@#{n}", val)} end end |
Instance Method Details
#rfm_force_array ⇒ Object
since XmlMini doesn’t know which will be returnd for any particular element. See Rfm Layout & Record where this is used.
34 35 36 37 |
# File 'lib/rfm/utilities/core_ext.rb', line 34 def rfm_force_array return [] if self.nil? self.is_a?(Array) ? self : [self] end |
#rfm_local_methods ⇒ Object
Just testing this functionality
40 41 42 |
# File 'lib/rfm/utilities/core_ext.rb', line 40 def rfm_local_methods self.methods - self.class.superclass.methods end |