Sha256: d55d194f8b4a0cf75ae49373695fbdc4eb2daa74343a23582a62c3b2e8d81c27
Contents?: true
Size: 637 Bytes
Versions: 1
Compression:
Stored size: 637 Bytes
Contents
require 'optparse' module LovelyRufus class CLIWrapper def initialize args = ARGV, text_wrapper: TextWrapper @settings = Settings.new args @text_wrapper = text_wrapper end def run stream = $stdin puts text_wrapper.wrap stream.read, width: settings.width end attr_reader :settings, :text_wrapper private :settings, :text_wrapper class Settings attr_reader :width def initialize args @width = 72 OptionParser.new do |opts| opts.on '-w', '--width WIDTH', Integer, 'Wrapping width' do |width| @width = width end end.parse! args end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lovely_rufus-0.1.2 | lib/lovely_rufus/cli_wrapper.rb |