Class: TestMemoize::Encoder
- Inherits:
-
Object
- Object
- TestMemoize::Encoder
- Includes:
- Rip::Memoize
- Defined in:
- lib/rip/memoize.rb
Instance Attribute Summary collapse
-
#encodes ⇒ Object
readonly
Returns the value of attribute encodes.
Instance Method Summary collapse
- #encode(name) ⇒ Object
-
#initialize ⇒ Encoder
constructor
A new instance of Encoder.
- #simple ⇒ Object
Methods included from Rip::Memoize
included, #memoize, #method_added
Constructor Details
#initialize ⇒ Encoder
Returns a new instance of Encoder.
52 53 54 |
# File 'lib/rip/memoize.rb', line 52 def initialize @encodes = 0 end |
Instance Attribute Details
#encodes ⇒ Object (readonly)
Returns the value of attribute encodes.
51 52 53 |
# File 'lib/rip/memoize.rb', line 51 def encodes @encodes end |
Instance Method Details
#encode(name) ⇒ Object
57 58 59 60 61 62 63 64 65 |
# File 'lib/rip/memoize.rb', line 57 def encode(name) @encodes += 1 parts = name.split(//).map do |letter| letter[0] end parts.join('/') end |
#simple ⇒ Object
68 69 70 71 |
# File 'lib/rip/memoize.rb', line 68 def simple @encodes += 1 1 + 1 end |