Sha256: 62c7c9e53ef1cc42bad0acc7c26dbb09cad96ee169bd7e7b63663abb1d80ddf9

Contents?: true

Size: 938 Bytes

Versions: 25

Compression:

Stored size: 938 Bytes

Contents

# frozen_string_literal: true

module PlatformosCheck
  module Tags
    class SignIn < Base
      SYNTAX = /\A([\w-]+[\s,]*[\w\s,]*)\s*(user_id:\s*(.+))?\z/
      VALID_ATTRUBTES = %w[user_id timeout_in_minutes].freeze

      def initialize(tag_name, markup, options)
        super

        raise Liquid::SyntaxError, "Syntax Error in 'sign_in' - Valid syntax: sign_in user_id: [user_id], timeout_in_minutes: [timeout_in_minutes]" if attributes_expr['user_id'].nil?

        wrong_attributes = attributes_expr.keys - VALID_ATTRUBTES
        raise Liquid::SyntaxError, "Syntax Error in 'sign_in' - Unknown argument(s): #{wrong_attributes.join(', ')}. Valid arguments: #{VALID_ATTRUBTES}" unless wrong_attributes.empty?
      end

      def parse_main_value(_tag_name, _markup); end

      class ParseTreeVisitor < Liquid::ParseTreeVisitor
        def children
          @node.attributes_expr.values
        end
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
platformos-check-0.2.0 lib/platformos_check/tags/sign_in.rb
platformos-check-0.1.0 lib/platformos_check/tags/sign_in.rb
platformos-check-0.0.3 lib/platformos_check/tags/sign_in.rb
platformos-check-0.0.2 lib/platformos_check/tags/sign_in.rb
platformos-check-0.0.1 lib/platformos_check/tags/sign_in.rb