<commit_before>#!/usr/bin/env ruby

require 'date'
require 'yaml'

require_relative 'easygpio.rb'

GARBAGE = YAML.load File.read("garbage.yaml")

gpio(
  led_paper:     +26,
  led_recycling: +19
) do

  def capacity_left? date, garbage
    most_recent_disposal = garbage["schedule"].reverse.find { |t| t < date }
    garbage_full_date    = most_recent_disposal + garbage["capacity"]

    date < garbage_full_date
  end

  loop do
    led_paper     (capacity_left? Date.today, GARBAGE["paper"    ])
    led_recycling (capacity_left? Date.today, GARBAGE["recycling"])
    sleep 60
  end

end<commit_msg>There's no such thing as a block local method<commit_after>#!/usr/bin/env ruby

require 'date'
require 'yaml'
require_relative 'easygpio.rb'

GARBAGE = YAML.load File.read("garbage.yaml")

def capacity_left? date, garbage
  most_recent_disposal = garbage["schedule"].reverse.find { |t| t < date }
  garbage_full_date    = most_recent_disposal + garbage["capacity"]

  date < garbage_full_date
end

gpio(
  led_paper:     +26,
  led_recycling: +19
) do

  loop do
    led_paper     (capacity_left? Date.today, GARBAGE["paper"    ])
    led_recycling (capacity_left? Date.today, GARBAGE["recycling"])
    sleep 60
  end

end
{'fraction_non_alphanumeric': 0.11365494685200327, 'fraction_numerical': 0.009811937857726901, 'mean_word_length': 3.975609756097561, 'pattern_counts': {'":': 0, '<': 7, '<?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': '3126289', 'n_tokens_mistral': 460, 'n_tokens_neox': 437, 'n_words': 99}