Sha256: cf233f59c8bf6e19559cb2440ad1fb5373d8a4f006ecf459dc7e87bf3ff96fc7

Contents?: true

Size: 1.35 KB

Versions: 46

Compression:

Stored size: 1.35 KB

Contents

module ViewModel
  module Cepc50
    class CepcRr < ViewModel::Cepc50::CommonSchema
      def recommendations(payback = "")
        if payback.empty?
          # return an enumerable of all nodes
          @xml_doc.xpath "RR-Recommendations"
        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

46 entries across 46 versions & 1 rubygems

Version Path
epb_view_models-1.0.25 lib/view_model/cepc50/cepc_rr.rb
epb_view_models-1.0.24 lib/view_model/cepc50/cepc_rr.rb
epb_view_models-1.0.23 lib/view_model/cepc50/cepc_rr.rb
epb_view_models-1.0.22 lib/view_model/cepc50/cepc_rr.rb
epb_view_models-1.0.21 lib/view_model/cepc50/cepc_rr.rb
epb_view_models-1.0.20 lib/view_model/cepc50/cepc_rr.rb
epb_view_models-1.0.19 lib/view_model/cepc50/cepc_rr.rb
epb_view_models-1.0.18 lib/view_model/cepc50/cepc_rr.rb
epb_view_models-1.0.17 lib/view_model/cepc50/cepc_rr.rb
epb_view_models-1.0.16 lib/view_model/cepc50/cepc_rr.rb
epb_view_models-1.0.15 lib/view_model/cepc50/cepc_rr.rb
epb_view_models-1.0.14 lib/view_model/cepc50/cepc_rr.rb
epb_view_models-1.0.13 lib/view_model/cepc50/cepc_rr.rb
epb_view_models-1.0.12 lib/view_model/cepc50/cepc_rr.rb
epb_view_models-1.0.11 lib/view_model/cepc50/cepc_rr.rb
epb_view_models-1.0.10 lib/view_model/cepc50/cepc_rr.rb
epb_view_models-1.0.9 lib/view_model/cepc50/cepc_rr.rb
epb_view_models-1.0.8 lib/view_model/cepc50/cepc_rr.rb
epb_view_models-1.0.7 lib/view_model/cepc50/cepc_rr.rb
epb_view_models-1.0.6 lib/view_model/cepc50/cepc_rr.rb