Class: WLang::Command
- Inherits:
-
Object
- Object
- WLang::Command
- Defined in:
- lib/wlang/command.rb
Overview
wlang – templating engine
SYNOPSIS
Usage: wlang [options] TEMPLATE [ATTR1 VALUE1 ATTR2 VALUE2]
OPTIONS: #summarized_options
DESCRIPTION
This command invokes the wlang templating engine on TEMPLATE and flushes the
rendering result on standard output.
Commandline template data can be passed through ATTR and VALUE arguments.
Instance Attribute Summary collapse
-
#ast ⇒ Object
readonly
Returns the value of attribute ast.
-
#compiling_options ⇒ Object
readonly
Returns the value of attribute compiling_options.
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#dialect ⇒ Object
readonly
Returns the value of attribute dialect.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
-
#tpl_file ⇒ Object
readonly
Returns the value of attribute tpl_file.
-
#yaml_front_matter ⇒ Object
readonly
Returns the value of attribute yaml_front_matter.
Instance Method Summary collapse
- #execute(argv) ⇒ Object
-
#initialize(*args) ⇒ Command
constructor
A new instance of Command.
Constructor Details
Instance Attribute Details
#ast ⇒ Object (readonly)
Returns the value of attribute ast.
23 24 25 |
# File 'lib/wlang/command.rb', line 23 def ast @ast end |
#compiling_options ⇒ Object (readonly)
Returns the value of attribute compiling_options.
24 25 26 |
# File 'lib/wlang/command.rb', line 24 def @compiling_options end |
#context ⇒ Object (readonly)
Returns the value of attribute context.
25 26 27 |
# File 'lib/wlang/command.rb', line 25 def context @context end |
#dialect ⇒ Object (readonly)
Returns the value of attribute dialect.
26 27 28 |
# File 'lib/wlang/command.rb', line 26 def dialect @dialect end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
21 22 23 |
# File 'lib/wlang/command.rb', line 21 def output @output end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
28 29 30 |
# File 'lib/wlang/command.rb', line 28 def template @template end |
#tpl_file ⇒ Object (readonly)
Returns the value of attribute tpl_file.
27 28 29 |
# File 'lib/wlang/command.rb', line 27 def tpl_file @tpl_file end |
#yaml_front_matter ⇒ Object (readonly)
Returns the value of attribute yaml_front_matter.
22 23 24 |
# File 'lib/wlang/command.rb', line 22 def yaml_front_matter @yaml_front_matter end |
Instance Method Details
#execute(argv) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/wlang/command.rb', line 63 def execute(argv) install(argv) if @ast begin require 'awesome_print' ap @template.to_ast rescue LoadError puts "HINT: install the 'awesome_print' gem for pretty output!" puts @template.to_ast.inspect end end with_output do |output| @template.render(@context, output) end end |