Class: Typedocs::TypeSpec::Named

Inherits:
Typedocs::TypeSpec show all
Defined in:
lib/typedocs/type_spec.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (readonly)

Returns the value of attribute name.



12
13
14
# File 'lib/typedocs/type_spec.rb', line 12

def name
  @name
end

#specObject (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 error_message_for(arg)
  spec.error_message_for(arg)
end

#to_sourceObject



15
# File 'lib/typedocs/type_spec.rb', line 15

def to_source; "#{name}:#{spec.to_source}"; end

#valid?(arg) ⇒ Boolean

Returns:

  • (Boolean)


14
# File 'lib/typedocs/type_spec.rb', line 14

def valid?(arg); spec.valid?(arg); end