Class: Seatsio::SocialDistancingRuleset

Inherits:
Object
  • Object
show all
Defined in:
lib/seatsio/domain.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, number_of_disabled_seats_to_the_sides: 0, disable_seats_in_front_and_behind: false, disable_diagonal_seats_in_front_and_behind: false, number_of_disabled_aisle_seats: 0, max_group_size: 0, max_occupancy_absolute: 0, max_occupancy_percentage: 0, one_group_per_table: false, fixed_group_layout: false, disabled_seats: [], enabled_seats: [], index: 0) ⇒ SocialDistancingRuleset

Returns a new instance of SocialDistancingRuleset.



521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
# File 'lib/seatsio/domain.rb', line 521

def initialize(name, number_of_disabled_seats_to_the_sides: 0, disable_seats_in_front_and_behind: false, disable_diagonal_seats_in_front_and_behind: false,
               number_of_disabled_aisle_seats: 0, max_group_size: 0, max_occupancy_absolute: 0, max_occupancy_percentage: 0, one_group_per_table: false,
               fixed_group_layout: false, disabled_seats: [], enabled_seats: [], index: 0)
  @name = name
  @number_of_disabled_seats_to_the_sides = number_of_disabled_seats_to_the_sides
  @disable_seats_in_front_and_behind = disable_seats_in_front_and_behind
  @disable_diagonal_seats_in_front_and_behind = disable_diagonal_seats_in_front_and_behind
  @number_of_disabled_aisle_seats = number_of_disabled_aisle_seats
  @max_group_size = max_group_size
  @max_occupancy_absolute = max_occupancy_absolute
  @max_occupancy_percentage = max_occupancy_percentage
  @one_group_per_table = one_group_per_table
  @fixed_group_layout = fixed_group_layout
  @disabled_seats = disabled_seats
  @enabled_seats = enabled_seats
  @index = index
end

Instance Attribute Details

#disable_diagonal_seats_in_front_and_behindObject (readonly)

Returns the value of attribute disable_diagonal_seats_in_front_and_behind.



517
518
519
# File 'lib/seatsio/domain.rb', line 517

def disable_diagonal_seats_in_front_and_behind
  @disable_diagonal_seats_in_front_and_behind
end

#disable_seats_in_front_and_behindObject (readonly)

Returns the value of attribute disable_seats_in_front_and_behind.



517
518
519
# File 'lib/seatsio/domain.rb', line 517

def disable_seats_in_front_and_behind
  @disable_seats_in_front_and_behind
end

#disabled_seatsObject (readonly)

Returns the value of attribute disabled_seats.



517
518
519
# File 'lib/seatsio/domain.rb', line 517

def disabled_seats
  @disabled_seats
end

#enabled_seatsObject (readonly)

Returns the value of attribute enabled_seats.



517
518
519
# File 'lib/seatsio/domain.rb', line 517

def enabled_seats
  @enabled_seats
end

#fixed_group_layoutObject (readonly)

Returns the value of attribute fixed_group_layout.



517
518
519
# File 'lib/seatsio/domain.rb', line 517

def fixed_group_layout
  @fixed_group_layout
end

#indexObject (readonly)

Returns the value of attribute index.



517
518
519
# File 'lib/seatsio/domain.rb', line 517

def index
  @index
end

#max_group_sizeObject (readonly)

Returns the value of attribute max_group_size.



517
518
519
# File 'lib/seatsio/domain.rb', line 517

def max_group_size
  @max_group_size
end

#max_occupancy_absoluteObject (readonly)

Returns the value of attribute max_occupancy_absolute.



517
518
519
# File 'lib/seatsio/domain.rb', line 517

def max_occupancy_absolute
  @max_occupancy_absolute
end

#max_occupancy_percentageObject (readonly)

Returns the value of attribute max_occupancy_percentage.



517
518
519
# File 'lib/seatsio/domain.rb', line 517

def max_occupancy_percentage
  @max_occupancy_percentage
end

#nameObject (readonly)

Returns the value of attribute name.



517
518
519
# File 'lib/seatsio/domain.rb', line 517

def name
  @name
end

#number_of_disabled_aisle_seatsObject (readonly)

Returns the value of attribute number_of_disabled_aisle_seats.



517
518
519
# File 'lib/seatsio/domain.rb', line 517

def number_of_disabled_aisle_seats
  @number_of_disabled_aisle_seats
end

#number_of_disabled_seats_to_the_sidesObject (readonly)

Returns the value of attribute number_of_disabled_seats_to_the_sides.



517
518
519
# File 'lib/seatsio/domain.rb', line 517

def number_of_disabled_seats_to_the_sides
  @number_of_disabled_seats_to_the_sides
end

#one_group_per_tableObject (readonly)

Returns the value of attribute one_group_per_table.



517
518
519
# File 'lib/seatsio/domain.rb', line 517

def one_group_per_table
  @one_group_per_table
end

Class Method Details

.fixed(name, disabled_seats: [], index: 0) ⇒ Object



539
540
541
# File 'lib/seatsio/domain.rb', line 539

def self.fixed(name, disabled_seats: [], index: 0)
  return SocialDistancingRuleset.new(name, index: index, disabled_seats: disabled_seats, fixed_group_layout: true)
end

.rule_based(name, number_of_disabled_seats_to_the_sides: 0, disable_seats_in_front_and_behind: false, disable_diagonal_seats_in_front_and_behind: false, number_of_disabled_aisle_seats: 0, max_group_size: 0, max_occupancy_absolute: 0, max_occupancy_percentage: 0, one_group_per_table: false, disabled_seats: [], enabled_seats: [], index: 0) ⇒ Object



543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
# File 'lib/seatsio/domain.rb', line 543

def self.rule_based(name, number_of_disabled_seats_to_the_sides: 0, disable_seats_in_front_and_behind: false, disable_diagonal_seats_in_front_and_behind: false,
                    number_of_disabled_aisle_seats: 0, max_group_size: 0, max_occupancy_absolute: 0, max_occupancy_percentage: 0, one_group_per_table: false,
                    disabled_seats: [], enabled_seats: [], index: 0)
  return SocialDistancingRuleset.new(name,
                                     number_of_disabled_seats_to_the_sides: number_of_disabled_seats_to_the_sides,
                                     disable_seats_in_front_and_behind: disable_seats_in_front_and_behind,
                                     disable_diagonal_seats_in_front_and_behind: disable_diagonal_seats_in_front_and_behind,
                                     number_of_disabled_aisle_seats: number_of_disabled_aisle_seats,
                                     max_group_size: max_group_size,
                                     max_occupancy_absolute: max_occupancy_absolute,
                                     max_occupancy_percentage: max_occupancy_percentage,
                                     one_group_per_table: one_group_per_table,
                                     fixed_group_layout: false,
                                     disabled_seats: disabled_seats,
                                     enabled_seats: enabled_seats,
                                     index: index)
end

Instance Method Details

#==(other) ⇒ Object



561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
# File 'lib/seatsio/domain.rb', line 561

def == (other)
  self.name == other.name &&
      self.number_of_disabled_seats_to_the_sides == other.number_of_disabled_seats_to_the_sides &&
      self.disable_seats_in_front_and_behind == other.disable_seats_in_front_and_behind &&
      self.disable_diagonal_seats_in_front_and_behind == other.disable_diagonal_seats_in_front_and_behind &&
      self.number_of_disabled_aisle_seats == other.number_of_disabled_aisle_seats &&
      self.max_group_size == other.max_group_size &&
      self.max_occupancy_absolute == other.max_occupancy_absolute &&
      self.max_occupancy_percentage == other.max_occupancy_percentage &&
      self.one_group_per_table == other.one_group_per_table &&
      self.fixed_group_layout == other.fixed_group_layout &&
      self.disabled_seats == other.disabled_seats &&
      self.enabled_seats == other.enabled_seats &&
      self.index == other.index
end