Class: TableWarnings::Arbitrary

Inherits:
Object
  • Object
show all
Defined in:
lib/table_warnings/arbitrary.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table, blk) ⇒ Arbitrary

Returns a new instance of Arbitrary.



6
7
8
9
# File 'lib/table_warnings/arbitrary.rb', line 6

def initialize(table, blk)
  @table = table
  @blk = blk
end

Instance Attribute Details

#blkObject (readonly)

Returns the value of attribute blk.



4
5
6
# File 'lib/table_warnings/arbitrary.rb', line 4

def blk
  @blk
end

#tableObject (readonly)

Returns the value of attribute table.



3
4
5
# File 'lib/table_warnings/arbitrary.rb', line 3

def table
  @table
end

Instance Method Details

#messagesObject



11
12
13
14
15
# File 'lib/table_warnings/arbitrary.rb', line 11

def messages
  if messages = table.instance_eval(&blk)
    [messages].flatten.select { |message| message.present? }
  end
end