Module: DuckTyper::MethodInspector
- Defined in:
- lib/duck_typer/method_inspector.rb
Overview
:nodoc:
Defined Under Namespace
Classes: ClassMethodInspector, InstanceMethodInspector
Constant Summary collapse
- TYPES =
%i[instance_methods class_methods].freeze
Class Method Summary collapse
Class Method Details
.for(object, type) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/duck_typer/method_inspector.rb', line 7 def self.for(object, type) unless TYPES.include?(type) raise ArgumentError, "Invalid type #{type.inspect}, must be one of #{TYPES}" end if type == :class_methods ClassMethodInspector else InstanceMethodInspector end.new(object) end |