Class: LovelyRufus::Executable

Inherits:
Object
  • Object
show all
Defined in:
lib/lovely-rufus/executable.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts = ARGV) ⇒ Executable

Returns a new instance of Executable.



3
4
5
6
7
8
9
10
# File 'lib/lovely-rufus/executable.rb', line 3

def initialize opts = ARGV
  @width = 72
  OptionParser.new do |opts|
    opts.on '-w', '--width WIDTH', Integer, 'Wrapping width' do |width|
      @width = width
    end
  end.parse! opts
end

Instance Method Details

#run(input = $stdin) ⇒ Object



12
13
14
# File 'lib/lovely-rufus/executable.rb', line 12

def run input = $stdin
  puts Wrapper.new(input.read).wrapped @width
end