<commit_before>//
//  Action.swift
//  Camira
//
//  Created by <NAME> on 18/05/2015.
//  Copyright (c) 2015 <NAME>. All rights reserved.
//

import Foundation
import Gloss

public class Action: Glossy {

    let nextScene: Scene

    public let text: String
    public var selected = false

    public init(text: String, nextScene: Scene) {
        self.text = text
        self.nextScene = nextScene;
    }
    
    public required init?(json: JSON) {
        guard let nextScene: Scene = "nextScene" <~~ json else { return nil}
        guard let text: String = "text" <~~ json else { return nil }
        self.nextScene = nextScene
        self.text = text
        if let selected: Bool = "selected" <~~ json {
            self.selected = selected
        }
    }
    
    public func toJSON() -> JSON? {
        return jsonify([
            "text" ~~> text,
            "selected" ~~> selected
        ])
    }
}<commit_msg>Fix `nextScene` not being persisted correctly in `Action`<commit_after>//
//  Action.swift
//  Camira
//
//  Created by <NAME> on 18/05/2015.
//  Copyright (c) 2015 <NAME>. All rights reserved.
//

import Foundation
import Gloss

public class Action: Glossy {

    let nextScene: Scene

    public let text: String
    public var selected = false

    public init(text: String, nextScene: Scene) {
        self.text = text
        self.nextScene = nextScene;
    }
    
    public required init?(json: JSON) {
        guard let nextScene: Scene = "nextScene" <~~ json else { return nil}
        guard let text: String = "text" <~~ json else { return nil }
        self.nextScene = nextScene
        self.text = text
        if let selected: Bool = "selected" <~~ json {
            self.selected = selected
        }
    }
    
    public func toJSON() -> JSON? {
        return jsonify([
            "nextScene" ~~> nextScene,
            "text" ~~> text,
            "selected" ~~> selected
        ])
    }
}
{'fraction_non_alphanumeric': 0.11655492521918515, 'fraction_numerical': 0.012377514182568335, 'mean_word_length': 1.9438543247344462, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '327008', 'n_tokens_mistral': 599, 'n_tokens_neox': 567, 'n_words': 183}