Class: Deplate::Command::VAR
- Inherits:
-
Deplate::Command
- Object
- Element
- Deplate::Command
- Deplate::Command::VAR
- Defined in:
- lib/deplate/commands.rb
Class Method Summary collapse
- .accumulate(src, array, deplate, text, match, args, cmd) ⇒ Object
- .set_variable(deplate, var, value, args = {}, src = nil) ⇒ Object
Methods inherited from Deplate::Command
commands, #finish, #format_special, #process, register_as, #setup, #setup_command, update_variables
Methods included from Names
name_match_c, name_match_fs, name_match_sf
Methods inherited from Element
#join_lines, #join_lines_re_zh_cn
Class Method Details
.accumulate(src, array, deplate, text, match, args, cmd) ⇒ Object
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/deplate/commands.rb', line 232 def accumulate(src, array, deplate, text, match, args, cmd) Deplate::Core.log("%s: %s" % [cmd, text], :debug, src) id = args['id'] if id if deplate.input.allow_set_variable(id) set_variable(deplate, id, text, args, src) end else cnt = Deplate::PseudoContainer.new(deplate, args) cnt.source = src opts, text = deplate.input.parse_args(text, cnt, false) for k, v in opts unless set_variable(deplate, k, v, args, src) opts.delete(k) end end end end |
.set_variable(deplate, var, value, args = {}, src = nil) ⇒ Object
217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
# File 'lib/deplate/commands.rb', line 217 def set_variable(deplate, var, value, args={}, src=nil) if deplate.input.allow_set_variable(var) deplate.(src, 'type' => 'variable', 'name' => var, 'value' => value ) update_variables(deplate.variables, args, var => value) return true else Deplate::Core.log(['Disabled', var], :error, src) return false end end |