Class: LXL::Namespace
Overview
Constants and functions defined here will become available to formulas.
class MyLXLNamespace < LXL::Namespace
NAME = 'John Doe'
def upper(string) string.to_s.upcase end
end
class MyLXL < LXL::Parser
def self.namespace_class() MyLXLNamespace end
end
MyLXL.eval('=UPPER(NAME)')
Constant Summary
collapse
- TRUE =
true
- FALSE =
false
- NULL =
nil
EmptyNamespace::METHODS
Instance Method Summary
collapse
const_defined?, deferred_class, register_deferred, register_symbols
Instance Method Details
#and(a, b) ⇒ Object
545
546
547
|
# File 'lib/lxl.rb', line 545
def and(a,b)
LXL.to_b(a) && LXL.to_b(b)
end
|
#date(y, m, d) ⇒ Object
577
578
579
|
# File 'lib/lxl.rb', line 577
def date(y,m,d)
Date.new(y,m,d).ajd.to_f
end
|
#datetime(string) ⇒ Object
581
582
583
|
# File 'lib/lxl.rb', line 581
def datetime(string)
DateTime.parse(string.to_s).ajd.to_f
end
|
#if(c, a, b) ⇒ Object
557
558
559
|
# File 'lib/lxl.rb', line 557
def if(c,a,b)
LXL.to_b(c) ? a : b
end
|
#in(n, h) ⇒ Object
565
566
567
|
# File 'lib/lxl.rb', line 565
def in(n,h)
h.respond_to?(:include?) ? h.include?(n) : false
end
|
#list(*items) ⇒ Object
561
562
563
|
# File 'lib/lxl.rb', line 561
def list(*items)
items
end
|
#not(c) ⇒ Object
553
554
555
|
# File 'lib/lxl.rb', line 553
def not(c)
! c
end
|
#now ⇒ Object
573
574
575
|
# File 'lib/lxl.rb', line 573
def now
DateTime.now.ajd.to_f
end
|
#or(a, b) ⇒ Object
549
550
551
|
# File 'lib/lxl.rb', line 549
def or(a,b)
LXL.to_b(a) || LXL.to_b(b)
end
|
#time(h, m, s) ⇒ Object
585
586
587
|
# File 'lib/lxl.rb', line 585
def time(h,m,s)
DateTime.valid_time?(h,m,s) ? DateTime.valid_time?(h,m,s).to_f : raise(ArgumentError, 'invalid time')
end
|
#today ⇒ Object
569
570
571
|
# File 'lib/lxl.rb', line 569
def today
Date.today.ajd.to_f
end
|