Class: Hamlit::CLI
- Inherits:
-
Thor
show all
- Defined in:
- lib/hamlit/cli.rb
Constant Summary
collapse
- IGNORED_COMPILERS =
['HTML'].freeze
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args) ⇒ Object
Flexible default_task, compatible with haml’s CLI
33
34
35
36
37
|
# File 'lib/hamlit/cli.rb', line 33
def method_missing(*args)
return super(*args) if args.length > 1
render(args.first.to_s)
end
|
Instance Method Details
#compile(file) ⇒ Object
15
16
17
18
|
# File 'lib/hamlit/cli.rb', line 15
def compile(file)
code = generate_code(file)
puts code
end
|
#parse(file) ⇒ Object
26
27
28
|
# File 'lib/hamlit/cli.rb', line 26
def parse(file)
pp generate_hamlit_ast(file)
end
|
#render(file) ⇒ Object
9
10
11
12
|
# File 'lib/hamlit/cli.rb', line 9
def render(file)
code = generate_code(file)
puts eval(code)
end
|
#temple(file) ⇒ Object
21
22
23
|
# File 'lib/hamlit/cli.rb', line 21
def temple(file)
pp generate_temple_ast(file)
end
|