Module: Tanj
- Defined in:
- lib/tanj.rb,
lib/tanj/cli.rb,
lib/tanj/version.rb,
lib/tanj/frontend.rb,
lib/tanj/logger/self.rb,
lib/tanj/logger/stderr.rb,
lib/tanj/logger/base_logger.rb
Defined Under Namespace
Modules: Logger
Classes: CLI, Frontend
Constant Summary
collapse
- VERSION =
"0.0.1"
- @@logger =
Logger::Stderr.new
Class Method Summary
collapse
Class Method Details
.array(name, options = {}) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/tanj.rb', line 17
def self.array(name, options = {})
b = binding.of_caller(1)
if options[:index]
options[:index].map! do |idx|
if idx.is_a? Symbol
{ name: idx, value: b.eval(idx.to_s) }
elsif idx.is_a? Range
[
idx.begin.is_a?(Symbol) ?
{ name: idx.begin, value: b.eval(idx.begin.to_s) } : { value: idx.begin },
idx.end.is_a?(Symbol) ?
{ name: idx.end, value: b.eval(idx.end.to_s) } : { value: idx.end }
]
else
idx
end
end
end
log(caller_locations[0], {
type: "array",
value: b.eval(name.to_s),
name: name,
options: options
})
end
|
.config(options) ⇒ Object
13
14
15
|
# File 'lib/tanj.rb', line 13
def self.config(options)
@@logger = options[:logger] unless options[:logger].nil?
end
|
.here ⇒ Object
57
58
59
|
# File 'lib/tanj.rb', line 57
def self.here
log(caller_locations[0], type: "here")
end
|
.message(msg) ⇒ Object
53
54
55
|
# File 'lib/tanj.rb', line 53
def self.message(msg)
log(caller_locations[0], type: "message", message: msg)
end
|
.var(name) ⇒ Object
45
46
47
48
49
50
51
|
# File 'lib/tanj.rb', line 45
def self.var(name)
log(caller_locations[0], {
type: "variable",
value: binding.of_caller(1).eval(name.to_s),
name: name
})
end
|