Class: Faker::Shorthand::Matcher

Inherits:
Object
  • Object
show all
Defined in:
lib/faker/shorthand/matcher.rb

Instance Method Summary collapse

Constructor Details

#initializeMatcher

Returns a new instance of Matcher.



4
5
6
7
# File 'lib/faker/shorthand/matcher.rb', line 4

def initialize
  @klass  = nil
  @method = nil
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, **args, &block) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/faker/shorthand/matcher.rb', line 9

def method_missing(method, **args, &block)
  unless @klass
    catch_module_errors { define_faker_class(method) }
    self
  else
    catch_method_errors { send_faker_method(method, **args, &block) }
  end
end