Module: Marko::Pluggable::Plug
- Defined in:
- lib/marko/gadgets/pluggable.rb
Instance Method Summary collapse
Instance Method Details
#plug(klass) ⇒ Object
39 40 41 |
# File 'lib/marko/gadgets/pluggable.rb', line 39 def plug(klass) @klass = klass end |
#plugged ⇒ Object
43 44 45 46 |
# File 'lib/marko/gadgets/pluggable.rb', line 43 def plugged fail "unknown @klass" unless @klass @plugged ||= @klass.new end |
#plugged=(obj) ⇒ Object
48 49 50 51 52 |
# File 'lib/marko/gadgets/pluggable.rb', line 48 def plugged=(obj) fail ArgumentError.new("required an instance of #{@klass}" ) unless obj.is_a?(@klass) @plugged = obj end |