Class: Ned::Quote

Inherits:
Command show all
Defined in:
lib/ned/commands/quote.rb

Instance Method Summary collapse

Methods inherited from Command

config, description, #execute, #execute_all, help, #initialize, #load_lines, long_name, option_parser, #options, #peek, require_all, #require_all, #require_all?, require_all?, short_name

Constructor Details

This class inherits a constructor from Ned::Command

Instance Method Details

#execute_internal(line) ⇒ Object



21
22
23
24
25
# File 'lib/ned/commands/quote.rb', line 21

def execute_internal(line)
  line.insert(0, @quote)
  line.insert_before_newline(@quote)
  @require_split ? line.split(/(?<=\n)/) : line
end

#parse(args) ⇒ Object



14
15
16
17
18
19
# File 'lib/ned/commands/quote.rb', line 14

def parse(args)
  super

  @quote = args.shift || '"'
  @require_split = !!@quote.index("\n")
end