Class: GameJsonGenerator

Inherits:
Object
  • Object
show all
Defined in:
app/generators/game_json_generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(game) ⇒ GameJsonGenerator

Returns a new instance of GameJsonGenerator


4
5
6
# File 'app/generators/game_json_generator.rb', line 4

def initialize(game)
  @game = game
end

Instance Attribute Details

#gameObject (readonly)

Returns the value of attribute game


2
3
4
# File 'app/generators/game_json_generator.rb', line 2

def game
  @game
end

Instance Method Details

#generateObject


8
9
10
11
12
13
14
# File 'app/generators/game_json_generator.rb', line 8

def generate
  {
    id: game.id.to_s,
    name: game.name,
    updated: game.updated_today?
  }
end

#generate_fullObject


16
17
18
19
20
21
22
23
24
# File 'app/generators/game_json_generator.rb', line 16

def generate_full
  {
    id: game.id.to_s,
    name: game.name,
    updated: game.updated_today?,
    items: items_json,
    data: items_data_json,
  }
end