Class: ActionWebService::BaseType

Inherits:
Object
  • Object
show all
Includes:
SignatureTypes
Defined in:
lib/action_web_service/support/signature_types.rb

Overview

:nodoc:

Direct Known Subclasses

ArrayType, StructuredType

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SignatureTypes

canonical_signature, canonical_signature_entry, canonical_type, canonical_type_class, canonical_type_name, class_to_type_name, derived_from?, symbol_name, type_name_to_class

Constructor Details

#initialize(spec, type, name) ⇒ BaseType

Returns a new instance of BaseType.



154
155
156
157
158
159
# File 'lib/action_web_service/support/signature_types.rb', line 154

def initialize(spec, type, name)
  @spec = spec
  @type = canonical_type(type)
  @type_class = canonical_type_class(@type)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



152
153
154
# File 'lib/action_web_service/support/signature_types.rb', line 152

def name
  @name
end

#specObject (readonly)

Returns the value of attribute spec.



149
150
151
# File 'lib/action_web_service/support/signature_types.rb', line 149

def spec
  @spec
end

#typeObject (readonly)

Returns the value of attribute type.



150
151
152
# File 'lib/action_web_service/support/signature_types.rb', line 150

def type
  @type
end

#type_classObject (readonly)

Returns the value of attribute type_class.



151
152
153
# File 'lib/action_web_service/support/signature_types.rb', line 151

def type_class
  @type_class
end

Instance Method Details

#array?Boolean

Returns:

  • (Boolean)


165
166
167
# File 'lib/action_web_service/support/signature_types.rb', line 165

def array?
  false
end

#custom?Boolean

Returns:

  • (Boolean)


161
162
163
# File 'lib/action_web_service/support/signature_types.rb', line 161

def custom?
  false
end

#human_name(show_name = true) ⇒ Object



173
174
175
176
177
# File 'lib/action_web_service/support/signature_types.rb', line 173

def human_name(show_name=true)
  type_type = array? ? element_type.type.to_s : self.type.to_s
  str = array? ? (type_type + '[]') : type_type
  show_name ? (str + " " + name.to_s) : str
end

#structured?Boolean

Returns:

  • (Boolean)


169
170
171
# File 'lib/action_web_service/support/signature_types.rb', line 169

def structured?
  false
end