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.



578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
# File 'lib/seatsio/domain.rb', line 578

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.



574
575
576
# File 'lib/seatsio/domain.rb', line 574

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.



574
575
576
# File 'lib/seatsio/domain.rb', line 574

def disable_seats_in_front_and_behind
  @disable_seats_in_front_and_behind
end

#disabled_seatsObject (readonly)

Returns the value of attribute disabled_seats.



574
575
576
# File 'lib/seatsio/domain.rb', line 574

def disabled_seats
  @disabled_seats
end

#enabled_seatsObject (readonly)

Returns the value of attribute enabled_seats.



574
575
576
# File 'lib/seatsio/domain.rb', line 574

def enabled_seats
  @enabled_seats
end

#fixed_group_layoutObject (readonly)

Returns the value of attribute fixed_group_layout.



574
575
576
# File 'lib/seatsio/domain.rb', line 574

def fixed_group_layout
  @fixed_group_layout
end

#indexObject (readonly)

Returns the value of attribute index.



574
575
576
# File 'lib/seatsio/domain.rb', line 574

def index
  @index
end

#max_group_sizeObject (readonly)

Returns the value of attribute max_group_size.



574
575
576
# File 'lib/seatsio/domain.rb', line 574

def max_group_size
  @max_group_size
end

#max_occupancy_absoluteObject (readonly)

Returns the value of attribute max_occupancy_absolute.



574
575
576
# File 'lib/seatsio/domain.rb', line 574

def max_occupancy_absolute
  @max_occupancy_absolute
end

#max_occupancy_percentageObject (readonly)

Returns the value of attribute max_occupancy_percentage.



574
575
576
# File 'lib/seatsio/domain.rb', line 574

def max_occupancy_percentage
  @max_occupancy_percentage
end

#nameObject (readonly)

Returns the value of attribute name.



574
575
576
# File 'lib/seatsio/domain.rb', line 574

def name
  @name
end

#number_of_disabled_aisle_seatsObject (readonly)

Returns the value of attribute number_of_disabled_aisle_seats.



574
575
576
# File 'lib/seatsio/domain.rb', line 574

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.



574
575
576
# File 'lib/seatsio/domain.rb', line 574

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.



574
575
576
# File 'lib/seatsio/domain.rb', line 574

def one_group_per_table
  @one_group_per_table
end

Class Method Details

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



596
597
598
# File 'lib/seatsio/domain.rb', line 596

def self.fixed(name, disabled_seats: [], index: 0)
  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



600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
# File 'lib/seatsio/domain.rb', line 600

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)
  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



618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
# File 'lib/seatsio/domain.rb', line 618

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