Class: Dhole::Image

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/dhole/image.rb

Instance Method Summary collapse

Instance Method Details

#global_usageObject



13
14
15
# File 'lib/dhole/image.rb', line 13

def global_usage
  GlobalImageLink.where(gil_to: img_name, gil_page_namespace_id: '0').pluck(:gil_wiki, :gil_page)
end

#global_usage_by_projectObject



16
17
18
19
20
21
22
23
24
# File 'lib/dhole/image.rb', line 16

def global_usage_by_project
  gu = global_usage
  ret = {}
  gu.each {|u|
    ret[u[0]] = [] if ret[u[0]].nil?
    ret[u[0]] << u[1]
  }
  return ret
end

#local_usageObject



10
11
12
# File 'lib/dhole/image.rb', line 10

def local_usage
  ImageLink.where(il_to: img_name).pluck(:il_from)
end