Sha256: dbe603cc8e2c9c1810beeb5cf7670b3420c978f302c3a5f89e3583f7f5ef0a26

Contents?: true

Size: 699 Bytes

Versions: 8

Compression:

Stored size: 699 Bytes

Contents

# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2020, by Samuel Williams.

require_relative 'tag'

module Decode
	module Comment
		# Describes an attribute type.
		#
		# - `@attribute [Integer] The person's age.`
		#
		class Attribute < Tag
			PATTERN = /\A\[(?<type>.*?)\](\s+(?<details>.*?))?\Z/
			
			def self.build(directive, match)
				node = self.new(directive, match[:type])
				
				if details = match[:details]
					node.add(Text.new(details))
				end
				
				return node
			end
			
			def initialize(directive, type)
				super(directive)
				
				@type = type
			end
			
			# The type of the attribute.
			# @attribute [String]
			attr :type
		end
	end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
decode-0.21.3 lib/decode/comment/attribute.rb
decode-0.21.2 lib/decode/comment/attribute.rb
decode-0.21.1 lib/decode/comment/attribute.rb
decode-0.21.0 lib/decode/comment/attribute.rb
decode-0.20.2 lib/decode/comment/attribute.rb
decode-0.20.1 lib/decode/comment/attribute.rb
decode-0.20.0 lib/decode/comment/attribute.rb
decode-0.19.0 lib/decode/comment/attribute.rb