Sha256: 592b21cf1910a1a8f0a1050c7492ac57f380e40edd29eb3c113461a5f4cdb34e

Contents?: true

Size: 1.33 KB

Versions: 47

Compression:

Stored size: 1.33 KB

Contents

module ViewModel
  module CepcNi800
    class CepcRr < ViewModel::CepcNi800::CommonSchema
      def recommendations(payback = "")
        if payback.empty?
          @xml_doc.search(%w[RR-Recommendations]).map { |node| node }
        else
          @xml_doc
            .search("RR-Recommendations/#{payback}")
            .map do |node|
              {
                code: node.at("Recommendation-Code").content,
                text: node.at("Recommendation").content,
                cO2Impact: node.at("CO2-Impact").content,
              }
            end
        end
      end

      def short_payback_recommendations
        recommendations("Short-Payback")
      end

      def medium_payback_recommendations
        recommendations("Medium-Payback")
      end

      def long_payback_recommendations
        recommendations("Long-Payback")
      end

      def other_recommendations
        recommendations("Other-Payback")
      end

      def floor_area
        xpath(%w[Technical-Information Floor-Area])
      end

      def building_environment
        xpath(%w[Building-Environment])
      end

      def calculation_tools
        xpath(%w[Calculation-Tool])
      end

      def related_certificate
        xpath(%w[Related-RRN])
      end

      def related_party_disclosure
        xpath(%w[Related-Party-Disclosure])
      end
    end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
epb_view_models-2.0.5 lib/view_model/cepc_ni800/cepc_rr.rb
epb_view_models-2.0.4 lib/view_model/cepc_ni800/cepc_rr.rb
epb_view_models-2.0.3 lib/view_model/cepc_ni800/cepc_rr.rb
epb_view_models-2.0.2 lib/view_model/cepc_ni800/cepc_rr.rb
epb_view_models-2.0.1 lib/view_model/cepc_ni800/cepc_rr.rb
epb_view_models-2.0.0 lib/view_model/cepc_ni800/cepc_rr.rb
epb_view_models-1.2.3 lib/view_model/cepc_ni800/cepc_rr.rb
epb_view_models-1.2.2 lib/view_model/cepc_ni800/cepc_rr.rb
epb_view_models-1.2.1 lib/view_model/cepc_ni800/cepc_rr.rb
epb_view_models-1.2.0 lib/view_model/cepc_ni800/cepc_rr.rb
epb_view_models-1.1.6 lib/view_model/cepc_ni800/cepc_rr.rb
epb_view_models-1.1.5 lib/view_model/cepc_ni800/cepc_rr.rb
epb_view_models-1.1.4 lib/view_model/cepc_ni800/cepc_rr.rb
epb_view_models-1.1.3 lib/view_model/cepc_ni800/cepc_rr.rb
epb_view_models-1.1.2 lib/view_model/cepc_ni800/cepc_rr.rb
epb_view_models-1.1.1 lib/view_model/cepc_ni800/cepc_rr.rb
epb_view_models-1.1.0 lib/view_model/cepc_ni800/cepc_rr.rb
epb_view_models-1.0.29 lib/view_model/cepc_ni800/cepc_rr.rb
epb_view_models-1.0.28 lib/view_model/cepc_ni800/cepc_rr.rb
epb_view_models-1.0.27 lib/view_model/cepc_ni800/cepc_rr.rb