Class: TableWarnings::Warning
- Inherits:
-
Object
- Object
- TableWarnings::Warning
- Defined in:
- lib/table_warnings/warning.rb,
lib/table_warnings/warning/size.rb,
lib/table_warnings/warning/blank.rb,
lib/table_warnings/warning/arbitrary.rb
Defined Under Namespace
Classes: Arbitrary, Blank, Size
Instance Attribute Summary collapse
-
#table ⇒ Object
readonly
Returns the value of attribute table.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(options = {}) ⇒ Warning
constructor
A new instance of Warning.
- #to_hash ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Warning
Returns a new instance of Warning.
9 10 11 12 13 |
# File 'lib/table_warnings/warning.rb', line 9 def initialize( = {}) .each do |k, v| instance_variable_set "@#{k}", v end end |
Instance Attribute Details
#table ⇒ Object (readonly)
Returns the value of attribute table.
7 8 9 |
# File 'lib/table_warnings/warning.rb', line 7 def table @table end |
Instance Method Details
#eql?(other) ⇒ Boolean
26 27 28 |
# File 'lib/table_warnings/warning.rb', line 26 def eql?(other) other.is_a?(Warning) and self.to_hash == other.to_hash end |
#hash ⇒ Object
22 23 24 |
# File 'lib/table_warnings/warning.rb', line 22 def hash to_hash.hash end |
#to_hash ⇒ Object
15 16 17 18 19 20 |
# File 'lib/table_warnings/warning.rb', line 15 def to_hash instance_variables.sort.inject({}) do |memo, ivar_name| memo[ivar_name.to_s.sub('@', '')] = instance_variable_get ivar_name memo end end |