Class: TradingviewScreener::Predicate
- Inherits:
-
Object
- Object
- TradingviewScreener::Predicate
- Defined in:
- lib/tradingview_screener/predicate.rb
Overview
Arel-like column node used inside where().
Screener[:close].gt(Screener[:SMA20])
Screener[:volume].gte(1_000_000)
Screener[:close].between(10, 300)
Instance Attribute Summary collapse
-
#left ⇒ Object
readonly
Returns the value of attribute left.
-
#operation ⇒ Object
readonly
Returns the value of attribute operation.
-
#right ⇒ Object
readonly
Returns the value of attribute right.
Instance Method Summary collapse
-
#initialize(left, operation, right = nil) ⇒ Predicate
constructor
A new instance of Predicate.
- #inspect ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(left, operation, right = nil) ⇒ Predicate
Returns a new instance of Predicate.
12 13 14 15 16 |
# File 'lib/tradingview_screener/predicate.rb', line 12 def initialize(left, operation, right = nil) @left = left.to_s @operation = operation.to_s @right = unwrap(right) end |
Instance Attribute Details
#left ⇒ Object (readonly)
Returns the value of attribute left.
10 11 12 |
# File 'lib/tradingview_screener/predicate.rb', line 10 def left @left end |
#operation ⇒ Object (readonly)
Returns the value of attribute operation.
10 11 12 |
# File 'lib/tradingview_screener/predicate.rb', line 10 def operation @operation end |
#right ⇒ Object (readonly)
Returns the value of attribute right.
10 11 12 |
# File 'lib/tradingview_screener/predicate.rb', line 10 def right @right end |
Instance Method Details
#inspect ⇒ Object
22 23 24 |
# File 'lib/tradingview_screener/predicate.rb', line 22 def inspect "#<#{self.class} #{left} #{operation} #{right.inspect}>" end |
#to_h ⇒ Object
18 19 20 |
# File 'lib/tradingview_screener/predicate.rb', line 18 def to_h { "left" => left, "operation" => operation, "right" => right } end |