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



81
82
83
84
# File 'lib/hamlit/cli.rb', line 81

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

Instance Method Details

#compile(file) ⇒ Object



17
18
19
# File 'lib/hamlit/cli.rb', line 17

def compile(file)
  print_code generate_code(file)
end

#parse(file) ⇒ Object



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

def parse(file)
  pp generate_ast(file)
end

#render(file) ⇒ Object



9
10
11
12
13
# File 'lib/hamlit/cli.rb', line 9

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

#temple(file) ⇒ Object



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

def temple(file)
  pp generate_temple(file)
end