Module: Sparsify::GuardMethods
- Included in:
- Sparsify
- Defined in:
- lib/sparsify/guard_methods.rb
Overview
Methods to ensure Sparsify isn’t mixed into nonsensical things
Instance Method Summary collapse
-
#extended(base) ⇒ Object
Sparsify can be extended into instances of Hash.
-
#included(base) ⇒ Object
Sparsigy can be included into implementations of Hash.
Instance Method Details
#extended(base) ⇒ Object
Sparsify can be extended into instances of Hash
8 9 10 11 12 |
# File 'lib/sparsify/guard_methods.rb', line 8 def extended(base) unless base.is_a? Hash raise ArgumentError, "<#{base.inspect}> is not a Hash!" end end |
#included(base) ⇒ Object
Sparsigy can be included into implementations of Hash
16 17 18 19 20 |
# File 'lib/sparsify/guard_methods.rb', line 16 def included(base) unless base <= Hash raise ArgumentError, "<#{base.inspect} does not inherit Hash" end end |