<commit_before><commit_msg>ch02: Gear : 4th version<commit_after>export default class Gear {
    constructor(chainring, cog, wheel = null) {
        this.chainring = chainring;
        this.cog = cog;
        this.wheel = wheel;
    }

    ratio() {
        return this.chainring / this.cog;
    }

    gear_inches() {
        return this.ratio() * this.wheel.diameter();
    }
}

class Wheel {
    constructor(rim, tire) {
        this.rim = rim;
        this.tire = tire;
    }

    diameter() {
        return this.rim + (this.tire * 2);
    }

    circumference() {
        return this.diameter() * Math.PI;
    }
}

if (require.main == module) {
    const wheel = new Wheel(26, 1.5);
    console.log(wheel.circumference());
    console.log((new Gear(52, 11, wheel)).gear_inches());
    console.log((new Gear(52, 11)).ratio());
}

{'fraction_non_alphanumeric': 0.1510791366906475, 'fraction_numerical': 0.019184652278177457, 'mean_word_length': 2.26171875, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1013671', 'n_tokens_mistral': 303, 'n_tokens_neox': 280, 'n_words': 58}