Class: Cure::Extract::Variable
- Inherits:
-
Object
- Object
- Cure::Extract::Variable
- Defined in:
- lib/cure/extract/variable.rb
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#ref_name ⇒ Object
readonly
Returns the value of attribute ref_name.
Instance Method Summary collapse
-
#initialize(name, location, ref_name: "_default") ⇒ Variable
constructor
A new instance of Variable.
- #row_bounds_range ⇒ Range
- #row_in_bounds?(row_idx) ⇒ Boolean
Constructor Details
#initialize(name, location, ref_name: "_default") ⇒ Variable
Returns a new instance of Variable.
8 9 10 11 12 13 |
# File 'lib/cure/extract/variable.rb', line 8 def initialize(name, location, ref_name: "_default") @name = name @location = [Extract::CsvLookup.position_for_letter(location), Extract::CsvLookup.position_for_digit(location)] @ref_name = ref_name end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
6 7 8 |
# File 'lib/cure/extract/variable.rb', line 6 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/cure/extract/variable.rb', line 6 def name @name end |
#ref_name ⇒ Object (readonly)
Returns the value of attribute ref_name.
6 7 8 |
# File 'lib/cure/extract/variable.rb', line 6 def ref_name @ref_name end |
Instance Method Details
#row_bounds_range ⇒ Range
20 21 22 |
# File 'lib/cure/extract/variable.rb', line 20 def row_bounds_range @row_bounds_range ||= (@location&.last..@location&.last) end |
#row_in_bounds?(row_idx) ⇒ Boolean
15 16 17 |
# File 'lib/cure/extract/variable.rb', line 15 def row_in_bounds?(row_idx) row_bounds_range.cover?(row_idx) end |