Class: Deplate::Regions::Write
- Inherits:
-
Native
- Object
- Element
- Deplate::Region
- Native
- Deplate::Regions::Write
- Defined in:
- lib/deplate/regions.rb
Instance Method Summary collapse
Methods inherited from Native
Methods inherited from Deplate::Region
check_file, clean_strings, #deprecated_regnote, deprecated_regnote, #finish_accum, #format_compound, regions, register_as, set_line_cont, #setup
Methods inherited from Element
#join_lines, #join_lines_re_zh_cn
Instance Method Details
#finish ⇒ Object
234 235 236 237 238 239 240 |
# File 'lib/deplate/regions.rb', line 234 def finish unless @args['noTemplate'] @args['template'] = true end # @vars = @deplate.variables.dup super end |
#format_special ⇒ Object
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
# File 'lib/deplate/regions.rb', line 242 def format_special # @elt = Deplate::Template.new(:template => @elt, # :source => @source, # :container => self) # Deplate::Define.let_variables(@deplate, @vars) do # @elt = @elt.fill_in(@deplate, :source => @source) # end # @elt = @elt.join("\n") # @elt = filter_template(@elt, @vars, :container => self).join("\n") fname = @args['file'] || @args['id'] if fname == '-' or @deplate.is_allowed?(['w', 'W'], :logger => self) if fname if fname == '-' # fname = 2 puts @elt else unless @deplate.is_allowed?('W') fname = File.basename(fname) end fname = Deplate::Core.get_out_fullname(fname, nil, @deplate.) sfx = @args['suffix'] || @args['sfx'] fname = [fname, sfx.gsub(/[^[:alnum:].]/, '_')].join('.') if sfx mode = @args['append'] ? 'a' : 'w' @deplate.write_file(fname, mode) do |io| io.puts(@elt) end end else log(['No filename'], :error) end end end |