Class: LovelyRufus::Executable

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

Instance Method Summary collapse

Constructor Details

#initialize(args = ARGV) ⇒ Executable

Returns a new instance of Executable.



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

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

Instance Method Details

#run(input = $stdin) ⇒ Object



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

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