Module: Memoized
- Defined in:
- lib/memoized.rb,
lib/memoized/version.rb,
lib/memoized/parameters.rb
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Classes: CannotMemoize, Parameters
Constant Summary
collapse
- VERSION =
'1.1.2'
Class Method Summary
collapse
Class Method Details
.included(base) ⇒ Object
6
7
8
9
|
# File 'lib/memoized.rb', line 6
def self.included(base)
base.extend ClassMethods
base.send :include, InstanceMethods
end
|
.ivar_name(method_name) ⇒ Object
15
16
17
|
# File 'lib/memoized.rb', line 15
def self.ivar_name(method_name)
:"@_memoized_#{self.safe_name(method_name)}"
end
|
.safe_name(method_name) ⇒ Object
11
12
13
|
# File 'lib/memoized.rb', line 11
def self.safe_name(method_name)
method_name.to_s.sub(/\?\Z/, '_query').sub(/!\Z/, '_bang').to_sym
end
|