Sha256: dd34ae8d30a104c9ece84a61cdf551119230da3cee397716707bc43434bf0222

Contents?: true

Size: 1.18 KB

Versions: 9

Compression:

Stored size: 1.18 KB

Contents

module Parliament
  module Grom
    module Decorator
      # Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/ProcedureStep
      module ProcedureStep
        # Alias procedureStepName with fallback.
        #
        # @return [String, String] the name of the Grom::Node or an empty string.
        def name
          respond_to?(:procedureStepName) ? procedureStepName : ''
        end

        # Alias procedureStepHasHouse with fallback.
        #
        # @return [Array, Array] an array of House Grom::Nodes or an empty array.
        def houses
          respond_to?(:procedureStepHasHouse) ? procedureStepHasHouse : []
        end

        # Alias distance with fallback.
        #
        # @return [Integer, Integer] an array of House Grom::Nodes or an empty array.
        def distance_from_origin
          respond_to?(:distance) ? distance.to_i : 0
        end

        # Alias procedureStepDescription with fallback.
        #
        # @return [String, String] the description of the ProcedureStep Grom::Node.
        def description
          respond_to?(:procedureStepDescription) ? procedureStepDescription : ''
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
parliament-grom-decorators-0.32.1 lib/parliament/grom/decorator/procedure_step.rb
parliament-grom-decorators-0.32.0 lib/parliament/grom/decorator/procedure_step.rb
parliament-grom-decorators-0.31.1 lib/parliament/grom/decorator/procedure_step.rb
parliament-grom-decorators-0.31.0 lib/parliament/grom/decorator/procedure_step.rb
parliament-grom-decorators-0.31.0.pre.rc lib/parliament/grom/decorator/procedure_step.rb
parliament-grom-decorators-0.30.0 lib/parliament/grom/decorator/procedure_step.rb
parliament-grom-decorators-0.29.0 lib/parliament/grom/decorator/procedure_step.rb
parliament-grom-decorators-0.27.7 lib/parliament/grom/decorator/procedure_step.rb
parliament-grom-decorators-0.27.6 lib/parliament/grom/decorator/procedure_step.rb