<commit_before># Usage:
#
# > console = Console.new('mark')
# > console.post_to_twitter 10, "This is a cool fact"
#
# or even invoke other commands/interactors
#
# > console.interactor :'facts/post_to_twitter', '10', 'hi'

class Console
  include Pavlov::Helpers

  def initialize username
    @username = username
  end

  def user
    @user ||= (User.find(@username) || raise("user not found"))
  end

  def ability
    @ability ||= Ability.new(user)
  end

  def pavlov_options
    {
      current_user: user,
      ability: ability
    }
  end

  def post_to_twitter(fact_id, message)
    id = Integer(fact_id).to_s

    interactor :'facts/post_to_twitter', id, message
  end
end<commit_msg>removed shortcut which doesn't really add a lot<commit_after># Usage:
#
# > console = Console.new('mark')
# > console.post_to_twitter 10, "This is a cool fact"
#
# or even invoke other commands/interactors
#
# > console.interactor :'facts/post_to_twitter', '10', 'hi'

class Console
  include Pavlov::Helpers

  def initialize username
    @username = username
  end

  def user
    @user ||= (User.find(@username) || raise("user not found"))
  end

  def ability
    @ability ||= Ability.new(user)
  end

  def pavlov_options
    {
      current_user: user,
      ability: ability
    }
  end
end
{'fraction_non_alphanumeric': 0.11764705882352941, 'fraction_numerical': 0.006191950464396285, 'mean_word_length': 3.4129692832764507, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '5366269', 'n_tokens_mistral': 450, 'n_tokens_neox': 425, 'n_words': 118}