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
Defined Under Namespace
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.
8 9 10 11 12 |
# File 'lib/table_warnings/warning.rb', line 8 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.
6 7 8 |
# File 'lib/table_warnings/warning.rb', line 6 def table @table end |
Instance Method Details
#eql?(other) ⇒ Boolean
25 26 27 |
# File 'lib/table_warnings/warning.rb', line 25 def eql?(other) other.is_a?(Warning) and self.to_hash == other.to_hash end |
#hash ⇒ Object
21 22 23 |
# File 'lib/table_warnings/warning.rb', line 21 def hash to_hash.hash end |
#to_hash ⇒ Object
14 15 16 17 18 19 |
# File 'lib/table_warnings/warning.rb', line 14 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 |