Module: Sodium::Delegate::ClassMethods
- Defined in:
- lib/sodium/delegate.rb
Instance Method Summary collapse
- #implementation(name = nil) ⇒ Object
- #implementation=(implementation) ⇒ Object
- #inherited(base) ⇒ Object
- #primitive ⇒ Object
Instance Method Details
#implementation(name = nil) ⇒ Object
24 25 26 27 |
# File 'lib/sodium/delegate.rb', line 24 def implementation(name = nil) name ? _find_implementation(name) : @_nacl_default ||= _find_implementation(self::DEFAULT) end |
#implementation=(implementation) ⇒ Object
29 30 31 |
# File 'lib/sodium/delegate.rb', line 29 def implementation=(implementation) @_nacl_default = implementation end |
#inherited(base) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/sodium/delegate.rb', line 10 def inherited(base) @_nacl_implementations ||= [] @_nacl_implementations << base class << base undef_method :implementation= define_method(:implementation) { self } end end |
#primitive ⇒ Object
20 21 22 |
# File 'lib/sodium/delegate.rb', line 20 def primitive self.implementation[:PRIMITIVE].to_sym end |