Sha256: 8d44c33f06c02d9d14c093b81097abd6e761fc9576cee844cd4a2a7ffd21c49f

Contents?: true

Size: 1.07 KB

Versions: 3

Compression:

Stored size: 1.07 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

        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

        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

3 entries across 3 versions & 1 rubygems

Version Path
theme-check-1.13.0 lib/theme_check/shopify_liquid/source_index/base_entry.rb
theme-check-1.12.1 lib/theme_check/shopify_liquid/source_index/base_entry.rb
theme-check-1.12.0 lib/theme_check/shopify_liquid/source_index/base_entry.rb