Class: Factbase::TermBase
- Inherits:
-
Object
- Object
- Factbase::TermBase
- Defined in:
- lib/factbase/terms/base.rb
Overview
Base class for all terms.
- Author
-
Volodya Lombrozo (volodya.lombrozo@gmail.com)
- Copyright
-
Copyright © 2024-2026 Yegor Bugayenko
- License
-
MIT
Direct Known Subclasses
Absent, Agg, Always, And, Arithmetic, As, Assert, Compare, Concat, Contains, Count, Defn, Div, Either, Empty, EndsWith, Env, Eq, Exists, First, Gt, Gte, Head, Inverted, Join, Lt, Lte, Many, Matches, Max, Min, Minus, Never, Nil, Not, Nth, One, Or, Plus, Prev, Size, Sorted, Sprintf, StartsWith, Sum, Term, Times, ToFloat, ToInteger, ToString, ToTime, Traced, Type, Undef, Unique, When, Zero
Instance Method Summary collapse
-
#to_s ⇒ String
Turns it into a string.
Instance Method Details
#to_s ⇒ String
Turns it into a string.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/factbase/terms/base.rb', line 13 def to_s @to_s ||= begin items = [] items << @op items += @operands.map do |o| if o.is_a?(String) "'#{o.gsub("'", "\\\\'").gsub('"', '\\\\"')}'" elsif o.is_a?(Time) o.utc.iso8601 else o.to_s end end "(#{items.join(' ')})" end end |