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
Flexible default_task, compatible with haml’s CLI
105
106
107
108
|
# File 'lib/hamlit/cli.rb', line 105
def method_missing(*args)
return super(*args) if args.length > 1
render(args.first.to_s)
end
|
Instance Method Details
#compile(file) ⇒ Object
22
23
24
25
|
# File 'lib/hamlit/cli.rb', line 22
def compile(file)
code = generate_code(file)
puts_code(code, color: options[:color])
end
|
#parse(file) ⇒ Object
35
36
37
|
# File 'lib/hamlit/cli.rb', line 35
def parse(file)
pp_object(generate_ast(file), color: options[:color])
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
29
30
31
|
# File 'lib/hamlit/cli.rb', line 29
def temple(file)
pp_object(generate_temple(file), color: options[:color])
end
|
40
41
42
|
# File 'lib/hamlit/cli.rb', line 40
def version
puts Hamlit::VERSION
end
|