Class: OCL::Range
- Inherits:
-
Object
- Object
- OCL::Range
- Defined in:
- lib/dbc/ocl.rb
Overview
Label
Instance Attribute Summary collapse
-
#first ⇒ Object
readonly
Returns the value of attribute first.
-
#last ⇒ Object
readonly
Returns the value of attribute last.
Instance Method Summary collapse
- #exclude_end? ⇒ Boolean
-
#initialize(first, last, exclude_end) ⇒ Range
constructor
A new instance of Range.
- #test_expression(expression) ⇒ Object
Constructor Details
#initialize(first, last, exclude_end) ⇒ Range
Returns a new instance of Range.
50 51 52 53 54 |
# File 'lib/dbc/ocl.rb', line 50 def initialize(first, last, exclude_end) @first = first @last = last @exclude_end = (exclude_end == true) end |
Instance Attribute Details
#first ⇒ Object (readonly)
Returns the value of attribute first.
66 67 68 |
# File 'lib/dbc/ocl.rb', line 66 def first @first end |
#last ⇒ Object (readonly)
Returns the value of attribute last.
66 67 68 |
# File 'lib/dbc/ocl.rb', line 66 def last @last end |
Instance Method Details
#exclude_end? ⇒ Boolean
55 56 57 |
# File 'lib/dbc/ocl.rb', line 55 def exclude_end? @exclude_end end |
#test_expression(expression) ⇒ Object
58 59 60 61 62 63 64 65 |
# File 'lib/dbc/ocl.rb', line 58 def test_expression(expression) if @exclude_end s = '<' else s = '<=' end "(((#{@first}) <= (#{expression})) && ((#{expression}) #{s} (#{@last})))" end |