Class: XxxRename::FetchActorDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/xxx_rename/actors_helper.rb

Instance Method Summary collapse

Constructor Details

#initialize(matcher) ⇒ FetchActorDetails

Returns a new instance of FetchActorDetails.

Parameters:



82
83
84
# File 'lib/xxx_rename/actors_helper.rb', line 82

def initialize(matcher)
  @matcher = matcher
end

Instance Method Details

#details(actor) ⇒ nil, Hash

Returns Hash of details or nil if not found.

Parameters:

  • actor (String)

    Search string for actor

Returns:

  • (nil, Hash)

    Hash of details or nil if not found



88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/xxx_rename/actors_helper.rb', line 88

def details(actor)
  clients.each do |client|
    details = client.actor_details(actor)
    next if details.nil?

    XxxRename.logger.debug "#{client.class.name.split("::").last} matched actor #{actor} as #{details["gender"]}"
    details.tap do |h|
      h["compressed_name"] = details["name"].normalize
      h["gender"]          = details["gender"].normalize
    end
    return details
  end
  nil
end