Sha256: f38d6fdf56cc2795dd78a3383ad098a18106af58c666f5c722205382b739bcd8
Contents?: true
Size: 628 Bytes
Versions: 1
Compression:
Stored size: 628 Bytes
Contents
module Usable class ModExtender attr_reader :name attr_accessor :copy, :mod, :config def initialize(mod, config = OpenStruct.new) @mod = mod @name = mod.name @copy = has_spec? ? mod.const_get(:UsableSpec).dup : mod.dup @config = config end # @note Destructive def call override copy end def override unwanted = config.only ? copy.instance_methods - Array(config.only) : [] unwanted.each do |method_name| copy.send :remove_method, method_name end end def has_spec? mod.const_defined?(:UsableSpec) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
usable-1.1.0 | lib/usable/mod_extender.rb |