Sha256: 8d32ce7dd47e699da632b5ff12259925765200f05d2e11b94f46ab59beb66d10

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

require 'www/enbujyo/util'

module WWW
  class Enbujyo
    class Player
      attr_reader :name, :name_image_url, :pclass, :title,
        :brave, :brave_desc, :seibou, :rank, :team,
        :wins, :loses, :games, :draws, :rate

      def initialize(attr)
        @name         = attr[:name]
        @name_image_url = 'http://enbujyo.3594t.com' + attr[:name_image_url]
        @accesscode   = attr[:accesscode]
        @team       = attr[:team]

        @title      = attr[:title]
        @brave      = attr[:brave]
        @brave_desc = attr[:brave_desc]
        @seibou     = attr[:seibou]
        @rank       = attr[:rank]

        @games = attr[:games]
        @wins  = attr[:wins]
        @loses = attr[:loses]
        @draws = attr[:draws]
        @rate  = attr[:rate]
      end

      def akashi?
        @brave_desc == '証'
      end

      def to_s
        "#{@name} #{@brave_desc}:#{@brave}"
      end

      def description
        "#{@name} #{@brave_desc}:#{@brave}\n" +
        "#{@wins}勝 #{@loses}負 勝率#{@rate}%"
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
holysugar-www-enbujyo-0.1.5 lib/www/enbujyo/player.rb
holysugar-www-enbujyo-0.1.6 lib/www/enbujyo/player.rb
holysugar-www-enbujyo-0.1.7 lib/www/enbujyo/player.rb