Module: RVM::ActsAsRVMType::ActsAsRVMTypeSingeltonMethods
- Defined in:
- lib/rvm/acts_as_rvm_type.rb
Instance Method Summary collapse
-
#functions ⇒ Object
This function will set up the variables for a rVM and replaces the current function with a shorter and faster one.
-
#variables ⇒ Object
This function will set up the variables for a rVM and replaces the current function with a shorter and faster one.
Instance Method Details
#functions ⇒ Object
This function will set up the variables for a rVM and replaces the current function with a shorter and faster one.
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/rvm/acts_as_rvm_type.rb', line 95 def functions # Copy the original functions hash so that changes to the instance # wont't carry over to to other instances. @functions = self.class.object_functions.dup # Redefine the function method to speed up further accesses. instance_eval do def functions @functions end end # Return the functions hash for the first call. @functions end |
#variables ⇒ Object
This function will set up the variables for a rVM and replaces the current function with a shorter and faster one.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/rvm/acts_as_rvm_type.rb', line 74 def variables puts self.class @variables = {} #gets the variables hash from the Test class and maps it to a getter/setter Class self.class.object_variables.each do |published_as, data| name, writable = data @variables[published_as.to_s] = RVM::Interpreter::VariableStorageCallback.new(self, name, writable) end #redefinces the variables method to remove overhead from mapping instance_eval do def variables @variables end end # Return the variables hash for the firs call. @variables end |