Class: SGK::Gacha::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/sgk/gacha/result.rb

Overview

ガチャ抽選の結果を表す。

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(card) ⇒ Result

Returns a new instance of Result.



10
11
12
# File 'lib/sgk/gacha/result.rb', line 10

def initialize(card)
  @card = card
end

Instance Attribute Details

#cardObject (readonly)

Returns the value of attribute card.



8
9
10
# File 'lib/sgk/gacha/result.rb', line 8

def card
  @card
end

Instance Method Details

#json_formatObject

JSON変換用メソッド



23
24
25
26
27
28
29
# File 'lib/sgk/gacha/result.rb', line 23

def json_format
  {
    card_id: @card.id,
    name: @card.name,
    rarity: @card.rarity
  }
end

#nameObject



14
15
16
# File 'lib/sgk/gacha/result.rb', line 14

def name
  @card.name
end

#rarityObject



18
19
20
# File 'lib/sgk/gacha/result.rb', line 18

def rarity
  @card.rarity
end