class Plugin::Twitter::UserList

Public Class Methods

new(value) click to toggle source
Calls superclass method
# File core/plugin/twitter/model/userlist.rb, line 35
def initialize(value)
  type_strict value => Hash
  super(value)
end

Public Instance Methods

add_member(user) click to toggle source
# File core/plugin/twitter/model/userlist.rb, line 66
def add_member(user)
  member_update_transaction do
    case user
    when Plugin::Twitter::User
      member << user
    when Integer
      Thread.new do
        user = Plugin::Twitter::User.findbyid(user)
        member << user
      end
    when Enumerable
      user.each(&method(:add_member))
    else
      raise ArgumentError.new("#{self.class} member must be User")
    end
  end
  self
end
member() click to toggle source
# File core/plugin/twitter/model/userlist.rb, line 49
def member
  self[:member] ||= Set.new end
member?(user) click to toggle source
# File core/plugin/twitter/model/userlist.rb, line 52
def member?(user)
  member.include?(user) if user.is_a? Plugin::Twitter::User
end
remove_member(user) click to toggle source
# File core/plugin/twitter/model/userlist.rb, line 85
def remove_member(user)
  member_update_transaction do
    case user
    when Plugin::Twitter::User
      member.delete(user)
    when Integer
      member.delete(Plugin::Twitter::User.findbyid(user))
    when Enumerable
      user.map(&remove_member)
    else
      raise ArgumentError.new("#{self.class} member must be User")
    end
  end
  self
end
user() click to toggle source

リストを所有しているユーザを返す

Return

リストの所有者(User)

# File core/plugin/twitter/model/userlist.rb, line 43
def user
  self[:user] end