Class: Typedocs::TypeSpec::Named
- Inherits:
-
Typedocs::TypeSpec
- Object
- Typedocs::TypeSpec
- Typedocs::TypeSpec::Named
- Defined in:
- lib/typedocs/type_spec.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#spec ⇒ Object
readonly
Returns the value of attribute spec.
Instance Method Summary collapse
- #error_message_for(arg) ⇒ Object
-
#initialize(name, spec) ⇒ Named
constructor
A new instance of Named.
- #to_source ⇒ Object
- #valid?(arg) ⇒ Boolean
Constructor Details
#initialize(name, spec) ⇒ Named
Returns a new instance of Named.
7 8 9 10 11 |
# File 'lib/typedocs/type_spec.rb', line 7 def initialize(name, spec) Typedocs.ensure_klass(spec, Typedocs::TypeSpec) @name = name @spec = spec end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
12 13 14 |
# File 'lib/typedocs/type_spec.rb', line 12 def name @name end |
#spec ⇒ Object (readonly)
Returns the value of attribute spec.
13 14 15 |
# File 'lib/typedocs/type_spec.rb', line 13 def spec @spec end |
Instance Method Details
#error_message_for(arg) ⇒ Object
16 17 18 |
# File 'lib/typedocs/type_spec.rb', line 16 def (arg) spec.(arg) end |
#to_source ⇒ Object
15 |
# File 'lib/typedocs/type_spec.rb', line 15 def to_source; "#{name}:#{spec.to_source}"; end |
#valid?(arg) ⇒ Boolean
14 |
# File 'lib/typedocs/type_spec.rb', line 14 def valid?(arg); spec.valid?(arg); end |