Class: Typedocs::TypeSpec::UserDefinedType
- Inherits:
-
Typedocs::TypeSpec
- Object
- Typedocs::TypeSpec
- Typedocs::TypeSpec::UserDefinedType
- Defined in:
- lib/typedocs/type_spec.rb
Instance Attribute Summary collapse
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(klass, name, spec = nil) ⇒ UserDefinedType
constructor
A new instance of UserDefinedType.
- #spec ⇒ Object
- #to_source ⇒ Object
- #valid?(arg) ⇒ Boolean
Methods inherited from Typedocs::TypeSpec
Constructor Details
#initialize(klass, name, spec = nil) ⇒ UserDefinedType
Returns a new instance of UserDefinedType.
179 180 181 182 183 184 |
# File 'lib/typedocs/type_spec.rb', line 179 def initialize(klass, name, spec = nil) raise ArgumentError, "Invalid UDT name: #{name.inspect}" unless Typedocs::Context.valid_udt_name?(name) @klass = klass @name = name @spec = spec end |
Instance Attribute Details
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
185 186 187 |
# File 'lib/typedocs/type_spec.rb', line 185 def klass @klass end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
186 187 188 |
# File 'lib/typedocs/type_spec.rb', line 186 def name @name end |
Instance Method Details
#spec ⇒ Object
187 188 189 |
# File 'lib/typedocs/type_spec.rb', line 187 def spec @spec ||= Typedocs.context(klass).defined_type!(name) end |
#to_source ⇒ Object
193 194 195 |
# File 'lib/typedocs/type_spec.rb', line 193 def to_source name end |
#valid?(arg) ⇒ Boolean
190 191 192 |
# File 'lib/typedocs/type_spec.rb', line 190 def valid?(arg) spec.valid?(arg) end |