From 49af97ca634e7ba1fb309a84043faa7039d1a07d Mon Sep 17 00:00:00 2001 From: Graham Turner Date: Wed, 19 Sep 2018 10:37:35 -0400 Subject: [PATCH] Removes link attr_reader from Cells (#457) * Removes link attr_reader from Cells * Adds deprecation method for link * Deprecated methods should still return a value --- lib/roo/excelx/cell/base.rb | 11 +++++++++-- lib/roo/excelx/cell/boolean.rb | 2 +- lib/roo/excelx/cell/date.rb | 2 +- lib/roo/excelx/cell/datetime.rb | 2 +- lib/roo/excelx/cell/empty.rb | 2 +- lib/roo/excelx/cell/number.rb | 2 +- lib/roo/excelx/cell/string.rb | 2 +- lib/roo/excelx/cell/time.rb | 2 +- 8 files changed, 16 insertions(+), 9 deletions(-) diff --git a/lib/roo/excelx/cell/base.rb b/lib/roo/excelx/cell/base.rb index 01d899fe..fb2ff779 100644 --- a/lib/roo/excelx/cell/base.rb +++ b/lib/roo/excelx/cell/base.rb @@ -71,9 +71,16 @@ def to_s formatted_value end - # DEPRECATED: Please use link instead. + # DEPRECATED: Please use link? instead. def hyperlink - warn '[DEPRECATION] `hyperlink` is deprecated. Please use `link` instead.' + warn '[DEPRECATION] `hyperlink` is deprecated. Please use `link?` instead.' + link? + end + + # DEPRECATED: Please use link? instead. + def link + warn '[DEPRECATION] `link` is deprecated. Please use `link?` instead.' + link? end # DEPRECATED: Please use cell_value instead. diff --git a/lib/roo/excelx/cell/boolean.rb b/lib/roo/excelx/cell/boolean.rb index 7c4afab8..2cdfc22e 100644 --- a/lib/roo/excelx/cell/boolean.rb +++ b/lib/roo/excelx/cell/boolean.rb @@ -4,7 +4,7 @@ module Roo class Excelx class Cell class Boolean < Cell::Base - attr_reader :value, :formula, :format, :cell_value, :link, :coordinate + attr_reader :value, :formula, :format, :cell_value, :coordinate attr_reader_with_default default_type: :boolean, cell_type: :boolean diff --git a/lib/roo/excelx/cell/date.rb b/lib/roo/excelx/cell/date.rb index 79b1f193..8627bc57 100644 --- a/lib/roo/excelx/cell/date.rb +++ b/lib/roo/excelx/cell/date.rb @@ -4,7 +4,7 @@ module Roo class Excelx class Cell class Date < Roo::Excelx::Cell::DateTime - attr_reader :value, :formula, :format, :cell_type, :cell_value, :link, :coordinate + attr_reader :value, :formula, :format, :cell_type, :cell_value, :coordinate attr_reader_with_default default_type: :date diff --git a/lib/roo/excelx/cell/datetime.rb b/lib/roo/excelx/cell/datetime.rb index ee18bb13..63f3260b 100644 --- a/lib/roo/excelx/cell/datetime.rb +++ b/lib/roo/excelx/cell/datetime.rb @@ -8,7 +8,7 @@ class Cell class DateTime < Cell::Base SECONDS_IN_DAY = 60 * 60 * 24 - attr_reader :value, :formula, :format, :cell_value, :link, :coordinate + attr_reader :value, :formula, :format, :cell_value, :coordinate attr_reader_with_default default_type: :datetime diff --git a/lib/roo/excelx/cell/empty.rb b/lib/roo/excelx/cell/empty.rb index 5adac797..f0c683c1 100644 --- a/lib/roo/excelx/cell/empty.rb +++ b/lib/roo/excelx/cell/empty.rb @@ -3,7 +3,7 @@ module Roo class Excelx class Cell class Empty < Cell::Base - attr_reader :value, :formula, :format, :cell_type, :cell_value, :hyperlink, :coordinate + attr_reader :value, :formula, :format, :cell_type, :cell_value, :coordinate attr_reader_with_default default_type: nil, style: nil diff --git a/lib/roo/excelx/cell/number.rb b/lib/roo/excelx/cell/number.rb index 7eddf536..8c7bd184 100644 --- a/lib/roo/excelx/cell/number.rb +++ b/lib/roo/excelx/cell/number.rb @@ -4,7 +4,7 @@ module Roo class Excelx class Cell class Number < Cell::Base - attr_reader :value, :formula, :format, :cell_value, :link, :coordinate + attr_reader :value, :formula, :format, :cell_value, :coordinate # FIXME: change default_type to number. This will break brittle tests. attr_reader_with_default default_type: :float diff --git a/lib/roo/excelx/cell/string.rb b/lib/roo/excelx/cell/string.rb index faeff8fb..dacf0b6e 100644 --- a/lib/roo/excelx/cell/string.rb +++ b/lib/roo/excelx/cell/string.rb @@ -2,7 +2,7 @@ module Roo class Excelx class Cell class String < Cell::Base - attr_reader :value, :formula, :format, :cell_value, :link, :coordinate + attr_reader :value, :formula, :format, :cell_value, :coordinate attr_reader_with_default default_type: :string, cell_type: :string diff --git a/lib/roo/excelx/cell/time.rb b/lib/roo/excelx/cell/time.rb index 7816dbd1..a1f08642 100644 --- a/lib/roo/excelx/cell/time.rb +++ b/lib/roo/excelx/cell/time.rb @@ -4,7 +4,7 @@ module Roo class Excelx class Cell class Time < Roo::Excelx::Cell::DateTime - attr_reader :value, :formula, :format, :cell_value, :link, :coordinate + attr_reader :value, :formula, :format, :cell_value, :coordinate attr_reader_with_default default_type: :time