Sha256: 19acf1eb52b4457131ba433224c4ad746b0d4fb6b66a739f8b8fabb02699a044
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
require 'rubygems' require 'thread' require 'csv' require 'twitter' require 'marky_markov' require 'yaml' $:.unshift(File.dirname(__FILE__)) require 'ebooks/version' require 'ebooks/core_ext' module Ebooks autoload :Generator, 'ebooks/generator' autoload :Twitter, 'ebooks/twitter' def self.read_config_file(file = '~/.ebooks') contents = File.read(file.sub('~', ENV["HOME"])) YAML.load(contents) end def self.configuration(overrides = {}) { :tweets_csv_path => 'tweets.csv', :corpus_path => 'markov_dict.txt', :dictionary_name => 'dictionary', # don't include the .mmd :twitter => { :consumer_key => '', :consumer_secret => '', :oauth_token => '', :oauth_token_secret => '' } }.deep_merge(overrides) end def self.generate(overrides = {}) config = self.configuration(overrides) generator = Ebooks::Generator.new(config) generator.generate_sentence end def self.tweet(overrides = {}) config = self.configuration(overrides) sentence = self.generate(overrides) Ebooks::Twitter.new(config[:twitter]).tweet(sentence) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ebooks-0.1.0 | lib/ebooks.rb |