Class: Vk::Schema::Definition::Constant
Instance Attribute Summary collapse
#definition, #schema
Class Method Summary
collapse
Instance Method Summary
collapse
#description, #to_s
Constructor Details
#initialize(name, definition, schema) ⇒ Constant
Returns a new instance of Constant.
15
16
17
18
|
# File 'lib/vk/schema/definition/constant.rb', line 15
def initialize(name, definition, schema)
super
@namespace, @name = name.split(self.class.namespace_splitter, 2)
end
|
Instance Attribute Details
#name ⇒ String
21
22
23
|
# File 'lib/vk/schema/definition/constant.rb', line 21
def name
@name
end
|
Class Method Details
.namespace_splitter ⇒ Object
8
9
10
|
# File 'lib/vk/schema/definition/constant.rb', line 8
def self.namespace_splitter
@namespace_splitter ||= /_/
end
|
Instance Method Details
#definition_file ⇒ String
44
45
46
|
# File 'lib/vk/schema/definition/constant.rb', line 44
def definition_file
"lib/#{require}.rb"
end
|
#namespace ⇒ String
24
25
26
|
# File 'lib/vk/schema/definition/constant.rb', line 24
def namespace
@namespace.camelize
end
|
#referenced_type_name ⇒ String
34
35
36
|
# File 'lib/vk/schema/definition/constant.rb', line 34
def referenced_type_name
"API::#{namespace}::#{type_name}"
end
|
#require ⇒ String
39
40
41
|
# File 'lib/vk/schema/definition/constant.rb', line 39
def require
"vk/api/#{@namespace}/#{@name}"
end
|
#spec_file ⇒ String
49
50
51
|
# File 'lib/vk/schema/definition/constant.rb', line 49
def spec_file
"spec/#{require}_spec.rb"
end
|
#type_name ⇒ String
29
30
31
|
# File 'lib/vk/schema/definition/constant.rb', line 29
def type_name
@type_name ||= name.camelize
end
|