Class: SsSyntax::CommandBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/ss_syntax/command_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(arguments = ARGV) ⇒ CommandBuilder

Returns a new instance of CommandBuilder.



6
7
8
9
# File 'lib/ss_syntax/command_builder.rb', line 6

def initialize(arguments = ARGV)
  @arguments = arguments
  @options   = options
end

Instance Method Details

#parseObject



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ss_syntax/command_builder.rb', line 11

def parse
  file_path = ARGV[0]
  return puts 'Please set ss file.' if file_path == nil

  file = File.open(file_path, 'r')
  text = file.read

  if @options[:html]
    puts Parse.new(text).to_h
  else
    puts Parse.new(text).to_s
  end
end