class SemanticLinefeeds::CLI

Public Class Methods

new(args) click to toggle source
# File lib/semantic_linefeeds/cli.rb, line 3
def initialize(args)
  @args = args
  puts Converter.run(input)
end

Private Instance Methods

input() click to toggle source
# File lib/semantic_linefeeds/cli.rb, line 10
def input
  if File.exist?(@args[0])
    File.read(@args[0])
  else
    string_from_args
  end
end
string_from_args() click to toggle source

If the user passes the string in surrounded by quotes, return that string. Else, if they don't, we'll join all the args into a string.

# File lib/semantic_linefeeds/cli.rb, line 20
def string_from_args
  if @args.is_a?(Array)
    @args.join(" ")
  else
    @args
  end
end