Sha256: 757a55d4737bec8a1a50e1a39ec01fe0debf30222473855db553046da430a4bb

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

module MicroMicro
  class ImpliedProperty < Property
    IMPLIED_PROPERTY_PARSERS_MAP = {
      "name"  => Parsers::ImpliedNamePropertyParser,
      "photo" => Parsers::ImpliedPhotoPropertyParser,
      "url"   => Parsers::ImpliedUrlPropertyParser
    }.freeze

    private_constant :IMPLIED_PROPERTY_PARSERS_MAP

    # Always return +true+ when asked if this {MicroMicro::ImpliedProperty} is
    # an implied property.
    #
    # @see https://microformats.org/wiki/microformats2-parsing#parsing_for_implied_properties
    #   microformats.org: microformats2 parsing specification ยง Parsing for implied properties
    #
    # @see MicroMicro::Property#implied?
    #
    # @return [Boolean]
    def implied?
      true
    end

    # Always return +false+ when asked if this {MicroMicro::ImpliedProperty} is
    # a {MicroMicro::Item} node.
    #
    # @return [Boolean]
    def item_node?
      false
    end

    private

    def parser
      @parser ||= IMPLIED_PROPERTY_PARSERS_MAP[name].new(self)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
micromicro-5.0.1 lib/micro_micro/implied_property.rb
micromicro-5.0.0 lib/micro_micro/implied_property.rb