<commit_before># encoding: utf-8

require 'mapnik_legendary/tags'
require 'mapnik_legendary/geometry'

module MapnikLegendary

  # A part is a combination of tags, geometry and layers.
  class Part
    attr_reader :tags, :geom, :layers

    def initialize(h, zoom, map, extra_tags)
      @tags = Tags.merge_nulls(h['tags'], extra_tags)
      @geom = Geometry.new(h['type'], zoom, map)
      @layers = h['layers']
    end
  end
end<commit_msg>Accept layer singular as well as plural.<commit_after># encoding: utf-8

require 'mapnik_legendary/tags'
require 'mapnik_legendary/geometry'

module MapnikLegendary

  # A part is a combination of tags, geometry and layers.
  class Part
    attr_reader :tags, :geom, :layers

    def initialize(h, zoom, map, extra_tags)
      @tags = Tags.merge_nulls(h['tags'], extra_tags)
      @geom = Geometry.new(h['type'], zoom, map)
      if h['layer']
        @layers = [ h['layer'] ]
      else
        @layers = h['layers']
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.11854103343465046, 'fraction_numerical': 0.002026342451874367, 'mean_word_length': 3.352422907488987, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4123901', 'n_tokens_mistral': 339, 'n_tokens_neox': 328, 'n_words': 95}