Class: EhbrsRubyUtils::CircularListSpreader::List::ItemPairSpreadness
- Inherits:
-
Object
- Object
- EhbrsRubyUtils::CircularListSpreader::List::ItemPairSpreadness
- Defined in:
- lib/ehbrs_ruby_utils/circular_list_spreader/list/item_pair_spreadness.rb
Instance Method Summary collapse
- #distance ⇒ Integer
- #left_path ⇒ Array
- #result ⇒ Integer
- #right_path ⇒ Array
- #to_left_distance ⇒ Integer
- #to_right_distance ⇒ Integer
Instance Method Details
#distance ⇒ Integer
17 18 19 |
# File 'lib/ehbrs_ruby_utils/circular_list_spreader/list/item_pair_spreadness.rb', line 17 def distance to_right_distance * to_left_distance end |
#left_path ⇒ Array
22 23 24 |
# File 'lib/ehbrs_ruby_utils/circular_list_spreader/list/item_pair_spreadness.rb', line 22 def left_path list.items.fetch(left_index).item.to_circular_list_spreader_path end |
#result ⇒ Integer
42 43 44 |
# File 'lib/ehbrs_ruby_utils/circular_list_spreader/list/item_pair_spreadness.rb', line 42 def result similarity * distance end |
#right_path ⇒ Array
27 28 29 |
# File 'lib/ehbrs_ruby_utils/circular_list_spreader/list/item_pair_spreadness.rb', line 27 def right_path item_on_index_path(right_index) end |
#to_left_distance ⇒ Integer
32 33 34 |
# File 'lib/ehbrs_ruby_utils/circular_list_spreader/list/item_pair_spreadness.rb', line 32 def to_left_distance right_index - left_index end |
#to_right_distance ⇒ Integer
37 38 39 |
# File 'lib/ehbrs_ruby_utils/circular_list_spreader/list/item_pair_spreadness.rb', line 37 def to_right_distance list.count - right_index + left_index end |