Sha256: d274983d52cbbf470b202564c68a2d8ed262c82a7059fb9044fc9cd44b5be1b6

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

# frozen_string_literal: true

require "forwardable"

module ThemeCheck
  module ShopifyLiquid
    class SourceIndex
      class BaseEntry
        extend Forwardable

        attr_reader :hash

        def_delegators :return_type_instance, :generic_type?, :array_type?, :array_type, :to_s, :denied_filters

        SHOPIFY_DEV_ROOT_URL = "https://shopify.dev/api/liquid"

        def initialize(hash = {})
          @hash = hash || {}
          @return_type = nil
        end

        def name
          hash['name']
        end

        def summary
          hash['summary'] || ''
        end

        def description
          hash['description'] || ''
        end

        def deprecated?
          hash['deprecated']
        end

        def deprecation_reason
          return nil unless deprecated?

          hash['deprecation_reason'] || nil
        end

        def shopify_dev_url
          SHOPIFY_DEV_ROOT_URL
        end

        attr_writer :return_type

        def return_type
          @return_type || to_s
        end

        def return_type_instance
          ReturnTypeEntry.new(return_type_hash)
        end

        private

        def return_type_hash
          hash['return_type']&.first
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
theme-check-1.15.0 lib/theme_check/shopify_liquid/source_index/base_entry.rb
theme-check-1.14.0 lib/theme_check/shopify_liquid/source_index/base_entry.rb