Module: Parliament::Grom::Decorator::House

Defined in:
lib/parliament/grom/decorator/house.rb

Overview

Decorator namespace for Grom::Node instances with type: id.parliament.uk/schema/House

Since:

  • 0.1.0

Instance Method Summary collapse

Instance Method Details

#commons?Boolean

Is this the commons?

Returns:

  • (Boolean)

    Boolean is the house the commons?

Since:

  • 0.1.0



51
52
53
# File 'lib/parliament/grom/decorator/house.rb', line 51

def commons?
  name == 'House of Commons'
end

#house_incumbenciesArray

Alias houseHasHouseIncumbency with fallback.

Returns:

  • (Array, Array)

    the house incumbencies of the Grom::Node or an empty array.

Since:

  • 0.1.0



37
38
39
# File 'lib/parliament/grom/decorator/house.rb', line 37

def house_incumbencies
  respond_to?(:houseHasHouseIncumbency) ? houseHasHouseIncumbency : []
end

#lords?Boolean

Is this the lords?

Returns:

  • (Boolean)

    Boolean is the house the lords?

Since:

  • 0.1.0



44
45
46
# File 'lib/parliament/grom/decorator/house.rb', line 44

def lords?
  name == 'House of Lords'
end

#nameString

Alias houseName with fallback.

Returns:

  • (String, String)

    the name of the Grom::Node or an empty string.

Since:

  • 0.1.0



9
10
11
# File 'lib/parliament/grom/decorator/house.rb', line 9

def name
  respond_to?(:houseName) ? houseName : ''
end

#seat_incumbenciesArray

Alias houseSeatHasSeatIncumbency with fallback.

Returns:

  • (Array, Array)

    the seat incumbencies of the Grom::Node or an empty array.

Since:

  • 0.1.0



16
17
18
19
20
21
22
23
24
25
# File 'lib/parliament/grom/decorator/house.rb', line 16

def seat_incumbencies
  return @seat_incumbencies unless @seat_incumbencies.nil?

  seat_incumbencies = []
  seats.each do |seat|
    seat_incumbencies << seat.seat_incumbencies
  end

  @seat_incumbencies = seat_incumbencies.flatten.uniq
end

#seatsArray

Alias houseHasHouseSeat with fallback.

Returns:

  • (Array, Array)

    the house seats of the Grom::Node or an empty array.

Since:

  • 0.1.0



30
31
32
# File 'lib/parliament/grom/decorator/house.rb', line 30

def seats
  respond_to?(:houseHasHouseSeat) ? houseHasHouseSeat : []
end