Class: Livetext::Processor
Constant Summary
collapse
- Disallowed =
[:nil?, :===, :=~, :!~, :eql?, :hash, :<=>,
:class, :singleton_class, :clone, :dup, :taint, :tainted?,
:untaint, :untrust, :untrusted?, :trust, :freeze, :frozen?,
:to_s, :inspect, :methods, :singleton_methods, :protected_methods,
:private_methods, :public_methods, :instance_variables,
:instance_variable_get, :instance_variable_set,
:instance_variable_defined?, :remove_instance_variable,
:instance_of?, :kind_of?, :is_a?, :tap, :send, :public_send,
:respond_to?, :extend, :display, :method, :public_method,
:singleton_method, :define_singleton_method, :object_id, :to_enum,
:enum_for, :pretty_inspect, :==, :equal?, :!, :!=, :instance_eval,
:instance_exec, :__send__, :__id__, :__binding__]
Constants included
from Standard
Standard::SimpleFormats
Instance Attribute Summary
Attributes included from Standard
#_data
Instance Method Summary
collapse
Methods included from UserAPI
#_args, #_body, #_body_text, #_check_existence, #_comment?, #_debug, #_debug=, #_end?, #_format, #_handle_escapes, #_optional_blank_line, #_out, #_out!, #_passthru, #_print, #_puts, #_raw_body, #_raw_body!, #_source, #_trailing?, #setvar
Methods included from Standard
#_assign_get_value, #_assign_get_var, #_assign_skip_equal, #_def, #_include, #_include_file, #_mixin, #_quoted_value, #_seek, #_unquoted_value, #backtrace, #banner, #bits, #br, #cleanup, #comment, #copy, #data=, #debug, #dlist, #errout, #func, #heading, #heredoc, #in_out, #inherit, #invoke, #link, #mixin, #mono, #newpage, #nopara, #nopass, #old_dlist, #para, #passthru, #quit, #r, #raw, #reval, #say, #seek, #set, #set_NEW, #shell, #shell!, #variables, #xtable
Constructor Details
#initialize(parent, output = nil) ⇒ Processor
Returns a new instance of Processor.
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/processor.rb', line 20
def initialize(parent, output = nil)
@parent = parent
@_nopass = false
@_nopara = false
@output = ::Livetext.output = (output || File.open("/dev/null", "w"))
@sources = []
@indentation = @parent.indentation
@_mixins = []
end
|
Instance Method Details
#_disallowed?(name) ⇒ Boolean
44
45
46
|
# File 'lib/processor.rb', line 44
def _disallowed?(name)
Disallowed.include?(name.to_sym)
end
|
#_error!(err, abort = true, trace = false) ⇒ Object
35
36
37
38
39
40
41
42
|
# File 'lib/processor.rb', line 35
def _error!(err, abort=true, trace=false)
where = @sources.last || @save_location
puts @parent.body
STDERR.puts "Error: #{err} (at #{where[1]} line #{where[2]})"
STDERR.puts err.backtrace if err.respond_to?(:backtrace)
exit if abort
end
|
#grab_file(fname) ⇒ Object
71
72
73
|
# File 'lib/processor.rb', line 71
def grab_file(fname)
File.read(fname)
end
|
#nextline ⇒ Object
61
62
63
64
65
66
67
68
69
|
# File 'lib/processor.rb', line 61
def nextline
return nil if @sources.empty?
line = @sources.last[0].next
@sources.last[2] += 1
line
rescue StopIteration
@sources.pop
nil
end
|
#output=(io) ⇒ Object
31
32
33
|
# File 'lib/processor.rb', line 31
def output=(io)
@output = io
end
|
#peek_nextline ⇒ Object
52
53
54
55
56
57
58
59
|
# File 'lib/processor.rb', line 52
def peek_nextline
line = @sources.last[0].peek
rescue StopIteration
@sources.pop
nil
rescue
nil
end
|
#source(enum, file, line) ⇒ Object
48
49
50
|
# File 'lib/processor.rb', line 48
def source(enum, file, line)
@sources.push([enum, file, line])
end
|