Class: Vk::Schema::Definition

Inherits:
Object
  • Object
show all
Defined in:
lib/vk/schema/definition.rb,
lib/vk/schema/definition/type.rb,
lib/vk/schema/definition/error.rb,
lib/vk/schema/definition/method.rb,
lib/vk/schema/definition/object.rb,
lib/vk/schema/definition/constant.rb,
lib/vk/schema/definition/response.rb,
lib/vk/schema/definition/attribute.rb,
lib/vk/schema/definition/has_attributes.rb

Direct Known Subclasses

Attribute, Constant, Error

Defined Under Namespace

Modules: HasAttributes Classes: Attribute, Constant, Error, Method, Object, Response, Type

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, definition, schema) ⇒ Definition

Returns a new instance of Definition.

Parameters:

  • name (String)
  • definition (Hash{String => String, Hash})
  • schema (Vk::Schema)

20
21
22
23
24
# File 'lib/vk/schema/definition.rb', line 20

def initialize(name, definition, schema)
  @name = name
  @definition = definition
  @schema = schema
end

Instance Attribute Details

#definitionHash (readonly)

Returns:

  • (Hash)

30
31
32
# File 'lib/vk/schema/definition.rb', line 30

def definition
  @definition
end

#nameString (readonly)

Returns:

  • (String)

27
28
29
# File 'lib/vk/schema/definition.rb', line 27

def name
  @name
end

#schemaSchema (readonly)

Returns:


33
34
35
# File 'lib/vk/schema/definition.rb', line 33

def schema
  @schema
end

Instance Method Details

#descriptionString

Returns:

  • (String)

36
37
38
39
# File 'lib/vk/schema/definition.rb', line 36

def description
  definition['description']&.gsub(/([{}])/, '\$1')&.strip ||
    '@see https://github.com/VKCOM/vk-api-schema/blob/master/objects.json'
end

#to_sString

Returns:

  • (String)

42
43
44
# File 'lib/vk/schema/definition.rb', line 42

def to_s
  name
end