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



66
67
68
69
# File 'lib/hamlit/cli.rb', line 66

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

Instance Method Details

#compile(file) ⇒ Object



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

def compile(file)
  print_code generate_code(file)
end

#parse(file) ⇒ Object



24
25
26
# File 'lib/hamlit/cli.rb', line 24

def parse(file)
  pp generate_ast(file)
end

#render(file) ⇒ Object



7
8
9
10
# File 'lib/hamlit/cli.rb', line 7

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

#temple(file) ⇒ Object



19
20
21
# File 'lib/hamlit/cli.rb', line 19

def temple(file)
  pp generate_temple(file)
end