File: user_mixin.rb

package info (click to toggle)
mikutter 3.8.6%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 10,544 kB
  • sloc: ruby: 20,548; sh: 99; makefile: 19
file content (43 lines) | stat: -rw-r--r-- 811 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# -*- coding: utf-8 -*-

=begin rdoc
Model用のmoduleで、これをincludeするとUserに要求されるいくつかのメソッドが定義される。
=end
module Diva::Model::UserMixin
  def user
    self
  end

  def icon
    Enumerator.new{|y|
      Plugin.filtering(:photo_filter, profile_image_url, y)
    }.map{|photo|
      Plugin.filtering(:miracle_icon_filter, photo)[0]
    }.first
  end

  def icon_large
    Enumerator.new{|y|
      Plugin.filtering(:photo_filter, profile_image_url_large, y)
    }.map{|photo|
      truth = Plugin.filtering(:miracle_icon_filter, photo)[0]
      if photo == truth
        truth
      else
        icon
      end
    }.first
  end

  def profile_image_url_large
    profile_image_url
  end

  def verified?
    false
  end

  def protected?
    false
  end
end