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



87
88
89
90
# File 'lib/hamlit/cli.rb', line 87

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

Instance Method Details

#compile(file) ⇒ Object



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

def compile(file)
  print_code generate_code(file)
end

#parse(file) ⇒ Object



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

def parse(file)
  pp generate_ast(file)
end

#render(file) ⇒ Object



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

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

#temple(file) ⇒ Object



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

def temple(file)
  pp generate_temple(file)
end

#versionObject



33
34
35
# File 'lib/hamlit/cli.rb', line 33

def version
  puts Hamlit::VERSION
end