Sha256: e0bda9b4a432fab1fb5ae743845ebfccb27b65c6c02475fbdc93183d175d8258

Contents?: true

Size: 516 Bytes

Versions: 18

Compression:

Stored size: 516 Bytes

Contents

module GreenButtonData
  module Relations

    ##
    # Extracts related URLs from an Entry
    #
    # ==== Arguments
    #
    # * +entry+ - An instance of GreenButtonData::Parser::Entry
    def construct_related_urls(entry)
      related_urls = {}

      entry.related.each do |related_url|
        match_data = /\/(\w+)(\/(\d+))*$/.match(related_url)

        unless match_data.nil?
          related_urls[:"#{match_data[1].underscore}"] = related_url
        end
      end

      related_urls
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
green-button-data-1.0.3 lib/green-button-data/relations.rb
green-button-data-1.0.1 lib/green-button-data/relations.rb
green-button-data-1.0.0 lib/green-button-data/relations.rb
green-button-data-0.7.5 lib/green-button-data/relations.rb
green-button-data-0.7.4 lib/green-button-data/relations.rb
green-button-data-0.7.3 lib/green-button-data/relations.rb
green-button-data-0.7.2 lib/green-button-data/relations.rb
green-button-data-0.7.1 lib/green-button-data/relations.rb
green-button-data-0.7.0 lib/green-button-data/relations.rb
green-button-data-0.6.0 lib/green-button-data/relations.rb
green-button-data-0.5.0 lib/green-button-data/relations.rb
green-button-data-0.4.2 lib/green-button-data/relations.rb
green-button-data-0.4.1 lib/green-button-data/relations.rb
green-button-data-0.3.2 lib/green-button-data/relations.rb
green-button-data-0.4.0 lib/green-button-data/relations.rb
green-button-data-0.4.0.alpha.pre.1 lib/green-button-data/relations.rb
green-button-data-0.3.1 lib/green-button-data/relations.rb
green-button-data-0.3.0 lib/green-button-data/relations.rb