lib/usable.rb in usable-1.3.1 vs lib/usable.rb in usable-1.4.0
- old
+ new
@@ -32,14 +32,18 @@
# @option [Array,Symbol] :only Limit which methods are copied from the module
# @option [String,Symbol] :method (:include) The method to use for including the module
# @return [ModExtender] containing the original and modified module
def usable(mod, options = {})
usable_options = { only: options.delete(:only), method: options.delete(:method) }
+ if mod.respond_to? :usable_config
+ mod.usable_config.to_h.each { |k, v| usable_config.public_send "#{k}=", v }
+ end
options.each { |k, v| usable_config.public_send "#{k}=", v }
yield usable_config if block_given?
mod_ext = ModExtender.new mod, usable_options
mod_ext.use! self
mod_ext.use_original! self
+ mod_ext.use_class_methods! self
mod_ext
end
# @return [Method] bound to the given -context-
def usable_method(context, method_name)