Class: Haml::CLI
- Inherits:
-
Thor
show all
- Defined in:
- lib/haml/cli.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args)
Flexible default_task, compatible with haml’s CLI
113
114
115
116
|
# File 'lib/haml/cli.rb', line 113
def method_missing(*args)
return super(*args) if args.length > 1
render(args.first.to_s)
end
|
Instance Method Details
#compile(file)
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/haml/cli.rb', line 23
def compile(file)
code = generate_code(file)
if options[:check]
if error = validate_ruby(code, file)
abort error.message.split("\n").first
end
puts "Syntax OK"
return
end
puts_code(code, color: options[:color])
end
|
#parse(file)
43
44
45
|
# File 'lib/haml/cli.rb', line 43
def parse(file)
pp_object(generate_ast(file), color: options[:color])
end
|
#render(file)
13
14
15
16
17
|
# File 'lib/haml/cli.rb', line 13
def render(file)
process_load_options
code = generate_code(file)
puts eval(code, binding, file)
end
|
#temple(file)
37
38
39
|
# File 'lib/haml/cli.rb', line 37
def temple(file)
pp_object(generate_temple(file), color: options[:color])
end
|
#version
48
49
50
|
# File 'lib/haml/cli.rb', line 48
def version
puts Haml::VERSION
end
|