Class: Mjai::MjsonArchive
- Defined in:
- lib/mjai/mjson_archive.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#raw_actions ⇒ Object
readonly
Returns the value of attribute raw_actions.
Attributes inherited from Game
#all_pais, #bakaze, #current_action, #dora_markers, #honba, #last, #num_pipais, #oya, #players, #previous_action
Instance Method Summary collapse
-
#initialize(path) ⇒ MjsonArchive
constructor
A new instance of MjsonArchive.
- #play ⇒ Object
Methods inherited from Archive
#actions, #each_action, #expect_response_from?, #inspect, load
Methods inherited from Game
#action_in_view, #distance, #do_action, #doras, #dump_action, #first_turn?, #get_hora, #on_action, #on_responses, #ranked_players, #render_board, #update_state, #validate, #validate_fields_exist, #validate_response_content, #validate_response_type, #validate_responses
Constructor Details
#initialize(path) ⇒ MjsonArchive
Returns a new instance of MjsonArchive.
10 11 12 13 14 15 16 17 |
# File 'lib/mjai/mjson_archive.rb', line 10 def initialize(path) super() @path = path @raw_actions = [] File.foreach(@path) do |line| @raw_actions.push(Action.from_json(line.chomp(), self)) end end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
19 20 21 |
# File 'lib/mjai/mjson_archive.rb', line 19 def path @path end |
#raw_actions ⇒ Object (readonly)
Returns the value of attribute raw_actions.
19 20 21 |
# File 'lib/mjai/mjson_archive.rb', line 19 def raw_actions @raw_actions end |
Instance Method Details
#play ⇒ Object
21 22 23 24 25 |
# File 'lib/mjai/mjson_archive.rb', line 21 def play() for action in @raw_actions do_action(action) end end |