Module: Usable
- Defined in:
- lib/usable/scoped.rb,
lib/usable.rb,
lib/usable/config.rb,
lib/usable/version.rb,
lib/usable/mod_extender.rb
Overview
Note:
UNTESTED and not included by default
Defined Under Namespace
Classes: Config, ModExtender, Scoped
Constant Summary collapse
- VERSION =
"1.0.0".freeze
Instance Attribute Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#usable_config ⇒ Object
10 11 12 |
# File 'lib/usable.rb', line 10 def usable_config @usable_config ||= Config.new end |
Instance Method Details
#usable(mod, options = {}) {|usable_config| ... } ⇒ Object
Note:
Hides methods
Note:
We include the primary mod when there is a UsableSpec set because any instance method defined on the mod are not configurable and should therefore takes precedence over those defined in the UsableSpec
29 30 31 32 33 34 35 |
# File 'lib/usable.rb', line 29 def usable(mod, = {}) .each { |k, v| usable_config.public_send "#{k}=", v } yield usable_config if block_given? mod_ext = ModExtender.new mod, usable_config usable! mod_ext.call usable! mod if mod_ext.has_spec? end |
#usable!(mod) ⇒ Object
38 39 40 41 |
# File 'lib/usable.rb', line 38 def usable!(mod) usable_config.modules << mod send :include, mod end |