Class: Google::SafeBrowsingList

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/rails/generators/google/model/templates/google/safe_browsing_list.rb

Class Method Summary collapse

Class Method Details

.list_by_name(name) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/rails/generators/google/model/templates/google/safe_browsing_list.rb', line 27

def list_by_name name
  if valid_list?(name.to_s)
    if malware_list.name == name.to_s
      malware_list
    elsif phishing_list.name == name.to_s
      phishing_list
    end
  else
    nil
  end
end

.malware_listObject



19
20
21
# File 'lib/rails/generators/google/model/templates/google/safe_browsing_list.rb', line 19

def malware_list
  @malware_list_obj ||= find_by_name MalwareList
end

.phishing_listObject



23
24
25
# File 'lib/rails/generators/google/model/templates/google/safe_browsing_list.rb', line 23

def phishing_list
  @phishing_list_obj ||= find_by_name PhishList
end

.valid_list?(list_name) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/rails/generators/google/model/templates/google/safe_browsing_list.rb', line 15

def valid_list? list_name
  [MalwareList, PhishList].include?(list_name.to_s)
end