<commit_before>require 'rspec'

describe Fixnum do 
  it "should return the closest lower fibonacci when sent closest_fibonacci" do
    156.closest_fibonacci.should == 144
    99.closest_fibonacci.should == 89
  end

  it "should return itself if it's a member of fibonacci" do 
    144.closest_fibonacci.should == 144
  end
  
  it "should return 0 or 1 if 0 or 1 (respectively) are sent closest_fibonacci" do 
    0.closest_fibonacci.should == 0
    1.closest_fibonacci.should == 1
  end

  it "should return self if self is negative" do 
    -5.closest_fibonacci.should == -5
  end

end

class Fixnum
  def closest_fibonacci(low = 0, high = 1)
    return self if [0,1].include?(self) or self < 0
    new_number = low + high
    return new_number if new_number + high > self
    closest_fibonacci(high, new_number)
  end
end
<commit_msg>moved closest_fibonacci logic into private method so that one can't pass arguments to closest_fibonacci<commit_after>require 'rspec'

describe Fixnum do 
  it "should return the closest lower fibonacci when sent closest_fibonacci" do
    156.closest_fibonacci.should == 144
    99.closest_fibonacci.should == 89
  end

  it "should return itself if it's a member of fibonacci and is sent closest_fibonacci" do 
    144.closest_fibonacci.should == 144
  end
  
  it "should return 0 or 1 if 0 or 1 (respectively) are sent closest_fibonacci" do 
    0.closest_fibonacci.should == 0
    1.closest_fibonacci.should == 1
  end

  it "should return self if self is negative" do 
    -5.closest_fibonacci.should == -5
  end

end

class Fixnum
  def closest_fibonacci
    next_fib_number
  end

  private

  def next_fib_number(low = 0, high = 1)
    return self if [0,1].include?(self) or self < 0
    new_number = low + high
    return new_number if new_number + high > self
    next_fib_number(high, new_number)
  end
end

{'fraction_non_alphanumeric': 0.06734913793103449, 'fraction_numerical': 0.0334051724137931, 'mean_word_length': 3.3694117647058826, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5469271', 'n_tokens_mistral': 707, 'n_tokens_neox': 619, 'n_words': 212}