Class: TableWarnings::Exclusive

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

Direct Known Subclasses

Blank, NonexistentOwner, Null, Range

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table, matcher, options = {}) ⇒ Exclusive

Returns a new instance of Exclusive.



7
8
9
10
11
# File 'lib/table_warnings/exclusive.rb', line 7

def initialize(table, matcher, options = {})
  @table = table
  @conditions = options[:conditions] || {}
  @scout = Scout.new table, matcher, options
end

Instance Attribute Details

#conditionsObject (readonly)

Returns the value of attribute conditions.



5
6
7
# File 'lib/table_warnings/exclusive.rb', line 5

def conditions
  @conditions
end

#scoutObject (readonly)

Returns the value of attribute scout.



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

def scout
  @scout
end

#tableObject (readonly)

Returns the value of attribute table.



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

def table
  @table
end

Instance Method Details

#covers(columns) ⇒ Object



21
22
23
# File 'lib/table_warnings/exclusive.rb', line 21

def covers(columns)
  columns.select { |column| scout.cover? column }
end

#exclusives(columns) ⇒ Object



13
14
15
# File 'lib/table_warnings/exclusive.rb', line 13

def exclusives(columns)
  columns.select { |column| scout.exclusive? column }
end

#matches(columns) ⇒ Object



17
18
19
# File 'lib/table_warnings/exclusive.rb', line 17

def matches(columns)
  columns.select { |column| scout.match? column }
end

#messages(columns) ⇒ Object



25
26
27
28
29
# File 'lib/table_warnings/exclusive.rb', line 25

def messages(columns)
  columns.map do |column|
    message column
  end
end