types 0.1.3 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d9009b2973c8d9b30fbc68da3eb4088ef28672339e593e63ed92f7f1685daf35
4
+ data.tar.gz: 45cbaae7e30b4603f59e7b95e8d85768edd8c8ded3df216c2c7087fdae839216
5
+ SHA512:
6
+ metadata.gz: 1cbda8d764a40a9adb42358620e21a5091dd98dee66904d14e170a96f58fdfc744ad4c613beccb5ec0f52ec17ca2b61261f4a58c664e7eb5bbe41b7788f95f88
7
+ data.tar.gz: 34341cc300faea4cfb3053388d928d84b32432e128c17ba3c7641ea757d65fbaab706683352731e6b13c67620e0e7f9d32bc84a9957f390346e69b70fc9defc9
checksums.yaml.gz.sig ADDED
Binary file
data/agent.md ADDED
@@ -0,0 +1,47 @@
1
+ # Agent
2
+
3
+ ## Context
4
+
5
+ This section provides links to documentation from installed packages. It is automatically generated and may be updated by running `bake agent:context:install`.
6
+
7
+ **Important:** Before performing any code, documentation, or analysis tasks, always read and apply the full content of any relevant documentation referenced in the following sections. These context files contain authoritative standards and best practices for documentation, code style, and project-specific workflows. **Do not proceed with any actions until you have read and incorporated the guidance from relevant context files.**
8
+
9
+ ### agent-context
10
+
11
+ Install and manage context files from Ruby gems.
12
+
13
+ #### [Usage Guide](.context/agent-context/usage.md)
14
+
15
+ `agent-context` is a tool that helps you discover and install contextual information from Ruby gems for AI agents. Gems can provide additional documentation, examples, and guidance in a `context/` ...
16
+
17
+ ### decode
18
+
19
+ Code analysis for documentation generation.
20
+
21
+ #### [Getting Started with Decode](.context/decode/getting-started.md)
22
+
23
+ The Decode gem provides programmatic access to Ruby code structure and metadata. It can parse Ruby files and extract definitions, comments, and documentation pragmas, enabling code analysis, docume...
24
+
25
+ #### [Documentation Coverage](.context/decode/coverage.md)
26
+
27
+ This guide explains how to test and monitor documentation coverage in your Ruby projects using the Decode gem's built-in bake tasks.
28
+
29
+ #### [Ruby Documentation](.context/decode/ruby-documentation.md)
30
+
31
+ This guide covers documentation practices and pragmas supported by the Decode gem for documenting Ruby code. These pragmas provide structured documentation that can be parsed and used to generate A...
32
+
33
+ ### sus
34
+
35
+ A fast and scalable test runner.
36
+
37
+ #### [Using Sus Testing Framework](.context/sus/usage.md)
38
+
39
+ Sus is a modern Ruby testing framework that provides a clean, BDD-style syntax for writing tests. It's designed to be fast, simple, and expressive.
40
+
41
+ #### [Mocking](.context/sus/mocking.md)
42
+
43
+ There are two types of mocking in sus: `receive` and `mock`. The `receive` matcher is a subset of full mocking and is used to set expectations on method calls, while `mock` can be used to replace m...
44
+
45
+ #### [Shared Test Behaviors and Fixtures](.context/sus/shared.md)
46
+
47
+ Sus provides shared test contexts which can be used to define common behaviours or tests that can be reused across one or more test files.
data/context/usage.md ADDED
@@ -0,0 +1,195 @@
1
+ # Usage
2
+
3
+ The Types gem provides abstract types for the Ruby programming language that can be used for documentation and evaluation purposes. It offers a simple and Ruby-compatible approach to type signatures, designed to work seamlessly with documentation tools and argument parsing.
4
+
5
+ ## Overview
6
+
7
+ This gem provides a simple and Ruby-compatible approach to type information. It offers:
8
+
9
+ - Simple type signature parsing.
10
+ - String-to-value coercion.
11
+ - Documentation integration.
12
+ - RBS compatibility.
13
+
14
+ The types are designed to be a subset of Ruby's type system, making them easy to understand and use while remaining powerful enough for most use cases.
15
+
16
+ ## How to Use Types
17
+
18
+ Types can be used directly as modules or classes:
19
+
20
+ ```ruby
21
+ # Simple types
22
+ Types::String.parse("hello") # => "hello"
23
+ Types::Integer.parse("42") # => 42
24
+ Types::Float.parse("3.14") # => 3.14
25
+ Types::Boolean.parse("true") # => true
26
+ Types::Symbol.parse("hello") # => :hello
27
+ ```
28
+
29
+ ### Composite Types
30
+
31
+ For more complex types, you can create composite types:
32
+
33
+ ```ruby
34
+ # Array with specific item type
35
+ array_type = Types::Array(Types::Integer)
36
+ array_type.parse(["1", "2", "3"]) # => [1, 2, 3]
37
+
38
+ # Hash with key and value types
39
+ hash_type = Types::Hash(Types::String, Types::Integer)
40
+ hash_type.parse("a:1,b:2") # => {"a" => 1, "b" => 2}
41
+
42
+ # Tuple types
43
+ tuple_type = Types::Tuple(Types::String, Types::Integer)
44
+ tuple_type.parse("hello,42") # => ["hello", 42]
45
+ ```
46
+
47
+ ### Union Types
48
+
49
+ You can create union types using the `|` operator:
50
+
51
+ ```ruby
52
+ # String or Integer
53
+ string_or_int = Types::String | Types::Integer
54
+ string_or_int.parse("hello") # => "hello"
55
+ string_or_int.parse("42") # => 42
56
+ ```
57
+
58
+ ## How to Parse Types
59
+
60
+ The main way to parse type signatures is using `Types.parse`:
61
+
62
+ ```ruby
63
+ # Simple types
64
+ Types.parse("String") # => Types::String
65
+ Types.parse("Integer") # => Types::Integer
66
+ Types.parse("Float") # => Types::Float
67
+
68
+ # Composite types
69
+ Types.parse("Array(String)") # => Types::Array(Types::String)
70
+ Types.parse("Hash(String, Integer)") # => Types::Hash(Types::String, Types::Integer)
71
+ Types.parse("Tuple(String, Integer)") # => Types::Tuple(Types::String, Types::Integer)
72
+
73
+ # Union types
74
+ Types.parse("String|Integer") # => Types::Any([Types::String, Types::Integer])
75
+ ```
76
+
77
+ ### Type Signature Format
78
+
79
+ The gem supports a subset of Ruby expressions for type signatures:
80
+
81
+ - Simple types: `String`, `Integer`, `Float`, `Boolean`, `Symbol`, `Nil`
82
+ - Composite types: `Array(Type)`, `Hash(KeyType, ValueType)`, `Tuple(Type1, Type2)`
83
+ - Union types: `Type1|Type2`
84
+ - Lambda types: `Lambda(ArgType, returns: ReturnType)`
85
+
86
+ ### Validation
87
+
88
+ Type signatures are validated against a regex pattern:
89
+
90
+ ```ruby
91
+ Types::VALID_SIGNATURE = /\A[a-zA-Z\(\):,_|\s]+\z/
92
+ ```
93
+
94
+ Invalid signatures will raise an `ArgumentError`:
95
+
96
+ ```ruby
97
+ Types.parse("Invalid@Type") # => ArgumentError: Invalid type signature: "Invalid@Type"!
98
+ ```
99
+
100
+ ## How to Use Types to Parse Strings into Values
101
+
102
+ Each type provides a `parse` method that can convert strings to typed values:
103
+
104
+ ```ruby
105
+ # Integer parsing
106
+ Types::Integer.parse("42") # => 42
107
+ Types::Integer.parse("0") # => 0
108
+ Types::Integer.parse("-123") # => -123
109
+
110
+ # String parsing (converts any input to string)
111
+ Types::String.parse(42) # => "42"
112
+ Types::String.parse("hello") # => "hello"
113
+
114
+ # Float parsing
115
+ Types::Float.parse("3.14") # => 3.14
116
+ Types::Float.parse("0.0") # => 0.0
117
+
118
+ # Boolean parsing
119
+ Types::Boolean.parse("true") # => true
120
+ Types::Boolean.parse("false") # => false
121
+ Types::Boolean.parse("1") # => true
122
+ Types::Boolean.parse("0") # => false
123
+ ```
124
+
125
+ ### Array Parsing
126
+
127
+ Arrays can parse both string representations and actual arrays:
128
+
129
+ ```ruby
130
+ array_type = Types::Array(Types::Integer)
131
+
132
+ # Parse string representation
133
+ array_type.parse("1,2,3") # => [1, 2, 3]
134
+ array_type.parse("'a','b','c'") # => ["a", "b", "c"]
135
+
136
+ # Parse actual array
137
+ array_type.parse(["1", "2", "3"]) # => [1, 2, 3]
138
+ ```
139
+
140
+ ### Hash Parsing
141
+
142
+ Hashes can parse string representations:
143
+
144
+ ```ruby
145
+ hash_type = Types::Hash(Types::String, Types::Integer)
146
+
147
+ # Parse string representation
148
+ hash_type.parse("a:1,b:2,c:3") # => {"a" => 1, "b" => 2, "c" => 3}
149
+ ```
150
+
151
+ ### Error Handling
152
+
153
+ Parsing methods will raise `ArgumentError` for invalid inputs:
154
+
155
+ ```ruby
156
+ Types::Integer.parse("not_a_number") # => ArgumentError
157
+ Types::Array(Types::Integer).parse("invalid") # => ArgumentError
158
+ ```
159
+
160
+ ### Practical Example: Command Line Arguments
161
+
162
+ This is particularly useful for parsing command line arguments:
163
+
164
+ ```ruby
165
+ def parse_arguments(arguments)
166
+ config = {
167
+ port: Types::Integer.parse(arguments[:port] || "8080"),
168
+ host: Types::String.parse(arguments[:host] || "localhost"),
169
+ debug: Types::Boolean.parse(arguments[:debug] || "false"),
170
+ tags: Types::Array(Types::String).parse(arguments[:tags] || "")
171
+ }
172
+
173
+ config
174
+ end
175
+
176
+ # Usage
177
+ parse_arguments(port: "3000", tags: "api,web,admin")
178
+ # => {port: 3000, host: "localhost", debug: false, tags: ["api", "web", "admin"]}
179
+ ```
180
+
181
+ ### Integration with Documentation
182
+
183
+ The types work seamlessly with documentation tools that use `@parameter` and `@returns` comments:
184
+
185
+ ```ruby
186
+ # @parameter port [Integer] The port number to bind to
187
+ # @parameter host [String] The host address to bind to
188
+ # @parameter tags [Array(String)] List of tags to apply
189
+ # @returns [Hash] Configuration hash
190
+ def create_server(port, host, tags)
191
+ # Implementation here
192
+ end
193
+ ```
194
+
195
+ This provides a clean, consistent way to handle type information throughout your Ruby applications.
data/lib/types/any.rb ADDED
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2022-2025, by Samuel Williams.
5
+
6
+ module Types
7
+ # Represents a union of multiple types. The first type to match the input is used.
8
+ #
9
+ # ```ruby
10
+ # type = Types::Any(Types::String, Types::Integer)
11
+ # ```
12
+ class Any
13
+ # Initialize the instance with an array of types.
14
+ # @parameter types [Array] The array of types.
15
+ def initialize(types)
16
+ @types = types
17
+ end
18
+
19
+ # @returns [Any] a new {Any} with the other type appended.
20
+ # @parameter other [Type] The type instance to append.
21
+ def | other
22
+ self.class.new([*@types, other])
23
+ end
24
+
25
+ # @returns [Boolean] true if any of the listed types is composite.
26
+ def composite?
27
+ @types.any? {|type| type.composite?}
28
+ end
29
+
30
+ # Parses the input using the listed types in order, returning the first one that succeeds.
31
+ # @parameter input [String] the input to parse.
32
+ # @returns [Object] the parsed value.
33
+ # @raises [ArgumentError] if no type can parse the input.
34
+ def parse(input)
35
+ @types.each do |type|
36
+ return type.parse(input)
37
+ rescue => error
38
+ last_error = error
39
+ end
40
+
41
+ if last_error
42
+ raise last_error
43
+ else
44
+ raise ArgumentError, "Unable to parse input #{input.inspect}!"
45
+ end
46
+ end
47
+
48
+ # Accepts any value as a class type.
49
+ def self.parse(value)
50
+ value
51
+ end
52
+
53
+ # @returns [String] a readable string representation of the listed types.
54
+ def to_s
55
+ if @types.empty?
56
+ "Any()"
57
+ else
58
+ "#{@types.join(' | ')}"
59
+ end
60
+ end
61
+
62
+ # @returns [String] the RBS type string, e.g. `String | Integer`.
63
+ def to_rbs
64
+ @types.map(&:to_rbs).join(" | ")
65
+ end
66
+ end
67
+
68
+ # Constructs an {Any} type from the given types.
69
+ # @parameter types [Array(Type)] The types to include in the union.
70
+ # @returns [Any] a new {Any} type.
71
+ def self.Any(*types)
72
+ Any.new(types)
73
+ end
74
+ end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2022-2025, by Samuel Williams.
5
+
6
+ require_relative "generic"
7
+
8
+ module Types
9
+ # Represents an array type with a specific item type.
10
+ #
11
+ # ```ruby
12
+ # type = Types::Array(Types::Integer)
13
+ # type.parse(["1", "2"]) # => [1, 2]
14
+ # ```
15
+ class Array
16
+ include Generic
17
+
18
+ # @parameter item_type [Type] The type of the array elements.
19
+ def initialize(item_type)
20
+ @item_type = item_type
21
+ end
22
+
23
+ # @returns [Boolean] true if this is a composite type.
24
+ def composite?
25
+ true
26
+ end
27
+
28
+ # Maps the given values using the item type's parse method.
29
+ # @parameter values [Array] The values to map.
30
+ # @returns [Array] The mapped array.
31
+ def map(values)
32
+ values.map{|value| @item_type.parse(value)}
33
+ end
34
+
35
+ # Parses the input as an array with the specified item type.
36
+ # @parameter input [Object] The value to parse.
37
+ # @returns [Array] The parsed array.
38
+ # @raises [ArgumentError] if the input cannot be converted to an array.
39
+ def parse(input)
40
+ case input
41
+ when ::String
42
+ return parse_values(parse_string(input))
43
+ when ::Array
44
+ return parse_values(input)
45
+ else
46
+ raise ArgumentError, "Cannot coerce #{input.inspect} into Array!"
47
+ end
48
+ end
49
+
50
+ # @returns [String] the string representation of the array type.
51
+ def to_s
52
+ "Array(#{@item_type})"
53
+ end
54
+
55
+ # @returns [String] the RBS type string, e.g. `Array[String]`.
56
+ def to_rbs
57
+ "Array[#{@item_type.to_rbs}]"
58
+ end
59
+
60
+ private
61
+
62
+ def parse_string(input)
63
+ ::JSON.parse("[#{input}]")
64
+ end
65
+
66
+ def parse_values(input)
67
+ input.map{|value, index| @item_type.parse(value)}
68
+ end
69
+ end
70
+
71
+ # Constructs an {Array} type from the given item type.
72
+ # @parameter item_type [Type] The type of the array elements.
73
+ # @returns [Array] a new {Array} type.
74
+ def self.Array(item_type = Any)
75
+ Array.new(item_type)
76
+ end
77
+ end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2022-2025, by Samuel Williams.
5
+
6
+ require_relative "method"
7
+
8
+ module Types
9
+ # Represents a block (Proc) type with argument and return types.
10
+ #
11
+ # ```ruby
12
+ # type = Types::Block(Types::String, Types::Integer, returns: Types::String)
13
+ # type.to_s # => "Block(String, Integer, returns: String)"
14
+ # ```
15
+ class Block
16
+ include Generic
17
+
18
+ # @parameter argument_types [Array(Type)] The types of the block arguments.
19
+ # @parameter return_type [Type | Nil] The return type of the block.
20
+ def initialize(argument_types, return_type)
21
+ @argument_types = argument_types
22
+ @return_type = return_type
23
+ end
24
+
25
+ # @returns [Array(Type)] The types of the block arguments.
26
+ attr :argument_types
27
+
28
+ # @returns [Type | Nil] The return type of the block.
29
+ attr :return_type
30
+
31
+ # @returns [Boolean] true if this is a composite type.
32
+ def composite?
33
+ true
34
+ end
35
+
36
+ # @returns [String] the string representation of the block type.
37
+ def to_s
38
+ if @return_type
39
+ "Block(#{@argument_types.join(', ')}, returns: #{@return_type})"
40
+ else
41
+ "Block(#{@argument_types.join(', ')})"
42
+ end
43
+ end
44
+
45
+ # @returns [String] the RBS type string, e.g. `Proc[(String, Integer) -> String]`.
46
+ def to_rbs
47
+ argument_types = @argument_types.map(&:to_rbs).join(", ")
48
+ return_type = @return_type ? @return_type.to_rbs : "void"
49
+
50
+ return "Proc[(#{argument_types}) -> #{return_type}]"
51
+ end
52
+ end
53
+
54
+ # Constructs a {Block} type from the given argument and return types.
55
+ # @parameter argument_types [Array(Type)] The types of the block arguments.
56
+ # @parameter returns [Type | Nil] The return type of the block.
57
+ # @returns [Block] a new {Block} type.
58
+ def self.Block(*argument_types, returns: nil)
59
+ Block.new(argument_types, returns)
60
+ end
61
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2022-2025, by Samuel Williams.
5
+
6
+ require_relative "generic"
7
+
8
+ module Types
9
+ # Represents a boolean type.
10
+ #
11
+ # ```ruby
12
+ # type = Types::Boolean
13
+ # type.parse("true") # => true
14
+ # type.parse("no") # => false
15
+ # ```
16
+ module Boolean
17
+ extend Generic
18
+
19
+ # Parses the input as a boolean.
20
+ # @parameter input [Object] The value to parse.
21
+ # @returns [Boolean] The parsed boolean value.
22
+ # @raises [ArgumentError] if the input cannot be converted to a boolean.
23
+ def self.parse(input)
24
+ if input =~ /t(rue)?|y(es)?/i
25
+ return true
26
+ elsif input =~ /f(alse)?|n(o)?/i
27
+ return false
28
+ else
29
+ raise ArgumentError, "Cannot coerce #{input.inspect} into Boolean!"
30
+ end
31
+ end
32
+
33
+ # @returns [String] the RBS type string, e.g. `bool`.
34
+ def self.to_rbs
35
+ "bool"
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2022-2025, by Samuel Williams.
5
+
6
+ require_relative "generic"
7
+
8
+ module Types
9
+ # Represents a class type, optionally constrained to a base class.
10
+ #
11
+ # ```ruby
12
+ # type = Types::Class(String)
13
+ # type.parse("Array") # => Array
14
+ # ```
15
+ class Class
16
+ extend Generic
17
+ include Generic
18
+
19
+ # @parameter base [Class] The base class constraint.
20
+ def initialize(base)
21
+ @base = base
22
+ end
23
+
24
+ # @returns [Class] the base class constraint.
25
+ attr :base
26
+
27
+ # @returns [Boolean] true if this is a composite type.
28
+ def composite?
29
+ true
30
+ end
31
+
32
+ # Parses the input as a class, optionally checking the base class constraint.
33
+ # @parameter input [String] The class name to parse.
34
+ # @returns [Class] the parsed class.
35
+ # @raises [ArgumentError] if the class is not a subclass of the base.
36
+ def parse(input)
37
+ klass = Object.const_get(input)
38
+
39
+ if @base and !klass.ancestors.include?(@base)
40
+ raise ArgumentError, "Class #{klass} is not a subclass of #{@base}!"
41
+ end
42
+
43
+ return klass
44
+ end
45
+
46
+ # @returns [Boolean] false for the class type itself.
47
+ def self.composite?
48
+ false
49
+ end
50
+
51
+ # @returns [String] the RBS type string, e.g. `Class`.
52
+ def to_rbs
53
+ "Class"
54
+ end
55
+
56
+ # Parses the input as a class, raising if not a class.
57
+ # @parameter input [String] The class name to parse.
58
+ # @returns [Class] the parsed class.
59
+ # @raises [ArgumentError] if the constant is not a class.
60
+ def self.parse(input)
61
+ klass = Object.const_get(input)
62
+
63
+ if !klass.is_a?(::Class)
64
+ raise ArgumentError, "Class #{klass} is not a Class!"
65
+ end
66
+
67
+ return klass
68
+ end
69
+ end
70
+
71
+ # Constructs a {Class} type with an optional base class constraint.
72
+ # @parameter base [Class] The base class constraint.
73
+ # @returns [Class] a new {Class} type.
74
+ def self.Class(base = Object)
75
+ Class.new(base)
76
+ end
77
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2022-2025, by Samuel Williams.
5
+
6
+ require_relative "generic"
7
+ require "bigdecimal"
8
+
9
+ module Types
10
+ # Represents a decimal type using BigDecimal.
11
+ #
12
+ # ```ruby
13
+ # type = Types::Decimal
14
+ # type.parse("3.14") # => #<BigDecimal ...>
15
+ # ```
16
+ module Decimal
17
+ extend Generic
18
+
19
+ # Parses the input as a BigDecimal.
20
+ # @parameter input [Object] The value to parse.
21
+ # @returns [BigDecimal] The parsed decimal value.
22
+ # @raises [ArgumentError] if the input cannot be converted to a BigDecimal.
23
+ def self.parse(input)
24
+ case input
25
+ when ::Float
26
+ BigDecimal(input, ::Float::DIG+1)
27
+ else
28
+ BigDecimal(input)
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2022-2025, by Samuel Williams.
5
+
6
+ require_relative "generic"
7
+
8
+ module Types
9
+ # Represents a floating point type.
10
+ #
11
+ # ```ruby
12
+ # type = Types::Float
13
+ # type.parse("3.14") # => 3.14
14
+ # ```
15
+ module Float
16
+ extend Generic
17
+
18
+ # Parses the input as a float.
19
+ # @parameter input [Object] The value to parse.
20
+ # @returns [Float] The parsed float value.
21
+ # @raises [ArgumentError] if the input cannot be converted to a float.
22
+ def self.parse(input)
23
+ Float(input)
24
+ end
25
+
26
+ # @returns [String] the RBS type string, e.g. `Float`.
27
+ def self.to_rbs
28
+ "Float"
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2022-2025, by Samuel Williams.
5
+
6
+ require_relative "any"
7
+
8
+ module Types
9
+ # An extension module which allows constructing `Any` types using the `|` operator.
10
+ #
11
+ # ```ruby
12
+ # type = Types::String | Types::Integer
13
+ # ```
14
+ module Generic
15
+ # Create an instance of `Any` with the arguments as types.
16
+ # @parameter other [Type] the alternative type to match.
17
+ # @returns [Any] a new {Any} type representing the union.
18
+ def | other
19
+ Any.new([self, other])
20
+ end
21
+
22
+ # @returns [String] the RBS representation of this type as a string.
23
+ # By default, this is the same as to_s, but can be overridden by composite types.
24
+ def to_rbs
25
+ to_s
26
+ end
27
+
28
+ # @returns [Boolean] whether a type contains nested types or not.
29
+ def composite?
30
+ false
31
+ end
32
+
33
+ # @returns [String] the string representation of the type.
34
+ def to_s
35
+ self.name.rpartition("::").last
36
+ end
37
+ end
38
+ end