Class: TimeConstraint
- Inherits:
-
Object
- Object
- TimeConstraint
- Defined in:
- lib/macrohub.rb
Instance Attribute Summary collapse
-
#time ⇒ Object
Returns the value of attribute time.
Instance Method Summary collapse
-
#initialize(timex = nil, times: timex, time: timex) ⇒ TimeConstraint
constructor
A new instance of TimeConstraint.
- #match?(detail) ⇒ Boolean
- #to_node ⇒ Object
- #to_rowx ⇒ Object
Constructor Details
#initialize(timex = nil, times: timex, time: timex) ⇒ TimeConstraint
Returns a new instance of TimeConstraint.
158 159 160 161 162 |
# File 'lib/macrohub.rb', line 158 def initialize(timex=nil, times: timex, time: timex) @time = times || time end |
Instance Attribute Details
#time ⇒ Object
Returns the value of attribute time.
156 157 158 |
# File 'lib/macrohub.rb', line 156 def time @time end |
Instance Method Details
#match?(detail) ⇒ Boolean
164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/macrohub.rb', line 164 def match?(detail) if $debug then puts 'inside TimeConstraint#match?' puts 'detail: ' + detail.inspect puts '@time: ' + @time.inspect end ChronicBetween.new(@time).within?(detail[:time]) end |
#to_node ⇒ Object
176 177 178 179 |
# File 'lib/macrohub.rb', line 176 def to_node() Rexle::Element.new(:constraint, \ attributes: {type: :time, time: @time}) end |
#to_rowx ⇒ Object
181 182 183 |
# File 'lib/macrohub.rb', line 181 def to_rowx() "constraint: %s" % @time end |