File: user_mixin.rb

package info (click to toggle)
mikutter 5.0.4%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 9,700 kB
  • sloc: ruby: 21,307; sh: 181; makefile: 19
file content (39 lines) | stat: -rw-r--r-- 790 bytes parent folder | download | duplicates (3)
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
# -*- coding: utf-8 -*-

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

  def icon
    Plugin.collect(:photo_filter, profile_image_url, Pluggaloid::COLLECT).map { |photo|
      Plugin.filtering(:miracle_icon_filter, photo)[0]
    }.first
  end

  def icon_large
    Plugin.collect(:photo_filter, profile_image_url_large, Pluggaloid::COLLECT).lazy.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