Sha256: 4aaddd1aea13ec3f5c4275b436333493c92de245bd115efc3a286e447a5c0077

Contents?: true

Size: 732 Bytes

Versions: 5

Compression:

Stored size: 732 Bytes

Contents

module Bipm
  module Data
    module Outcomes
      class LocalizedBody < Body
        def initialize(body, locale)
          super
          @locale = locale
        end

        attr_reader :locale

        def file_path
          "#{super}meetings-#{@locale}/"
        end


        def meeting(name)
          Meeting.new(self, name)
        end
        alias [] meeting

        def meetings
          Dir["#{file_path}*"].to_h do |name|
            name = name.split("/").last.split("-", 2).last.split(".").first
            
            [name, meeting(name)]
          end
        end
        
        def each(&block)
          meetings.values.each(&block)
        end
        include Enumerable
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bipm-data-importer-0.2.2 lib/bipm/data/outcomes/localized_body.rb
bipm-data-importer-0.2.1 lib/bipm/data/outcomes/localized_body.rb
bipm-data-importer-0.2.0 lib/bipm/data/outcomes/localized_body.rb
bipm-data-importer-0.1.3 lib/bipm/data/outcomes/localized_body.rb
bipm-data-importer-0.1.2 lib/bipm/data/outcomes/localized_body.rb