Class: Hamlit::CLI

Inherits:
Thor show all
Defined in:
lib/hamlit/cli.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args) ⇒ Object (private)

Flexible default_task, compatible with haml’s CLI



93
94
95
96
# File 'lib/hamlit/cli.rb', line 93

def method_missing(*args)
  return super(*args) if args.length > 1
  render(args.first.to_s)
end

Instance Method Details

#compile(file) ⇒ Object



21
22
23
# File 'lib/hamlit/cli.rb', line 21

def compile(file)
  print_code generate_code(file)
end

#parse(file) ⇒ Object



31
32
33
# File 'lib/hamlit/cli.rb', line 31

def parse(file)
  pp generate_ast(file)
end

#render(file) ⇒ Object



13
14
15
16
17
# File 'lib/hamlit/cli.rb', line 13

def render(file)
  process_load_options
  code = generate_code(file)
  puts eval(code)
end

#temple(file) ⇒ Object



26
27
28
# File 'lib/hamlit/cli.rb', line 26

def temple(file)
  pp generate_temple(file)
end

#versionObject



36
37
38
# File 'lib/hamlit/cli.rb', line 36

def version
  puts Hamlit::VERSION
end