Class: PossibleEmail::Response

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/possible_email/response.rb

Instance Method Summary collapse

Constructor Details

#initialize(profiles) ⇒ Response

Returns a new instance of Response.



5
6
7
8
# File 'lib/possible_email/response.rb', line 5

def initialize(profiles)
  # remove nils created by ResponseGetter
  @profiles = profiles.compact
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method) ⇒ Object



18
19
20
# File 'lib/possible_email/response.rb', line 18

def method_missing(method, *)
  respond_to?(method) ? @profiles.send(method) : super
end

Instance Method Details

#[](*args) ⇒ Object



14
15
16
# File 'lib/possible_email/response.rb', line 14

def [](*args)
  @profiles[*args]
end

#each(&block) ⇒ Object



10
11
12
# File 'lib/possible_email/response.rb', line 10

def each(&block)
  @profiles.each(&block)
end

#respond_to?(method) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/possible_email/response.rb', line 22

def respond_to?(method, *)
  @profiles.respond_to?(method)
end