Class: TableWarnings::Warning

Inherits:
Object
  • Object
show all
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

Direct Known Subclasses

Arbitrary, Blank, Size

Defined Under Namespace

Classes: Arbitrary, Blank, Size

Instance Attribute Summary collapse

Instance Method Summary collapse

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(options = {})
  options.each do |k, v|
    instance_variable_set "@#{k}", v
  end
end

Instance Attribute Details

#tableObject (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

Returns:

  • (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

#hashObject



22
23
24
# File 'lib/table_warnings/warning.rb', line 22

def hash
  to_hash.hash
end

#to_hashObject



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