Class: Thrift::StructDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/thrift/definition.rb

Direct Known Subclasses

ServiceDefinition

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ StructDefinition

Returns a new instance of StructDefinition.



13
14
15
# File 'lib/thrift/definition.rb', line 13

def initialize(klass)
  @klass = klass
end

Instance Attribute Details

#klassObject (readonly)

Returns the value of attribute klass.



11
12
13
# File 'lib/thrift/definition.rb', line 11

def klass
  @klass
end

Instance Method Details

#canonical_namesObject



41
42
43
44
45
# File 'lib/thrift/definition.rb', line 41

def canonical_names
  CANONICAL_NAME_EXTRACTORS.reduce([]) do |acc, cur|
    acc + cur.extract(self)
  end
end

#legacy_annotationsObject



23
24
25
26
27
# File 'lib/thrift/definition.rb', line 23

def legacy_annotations
  return {} unless @klass.const_defined? :LEGACY_ANNOTATIONS

  @klass::LEGACY_ANNOTATIONS
end

#nameObject



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

def name
  @klass::NAME
end

#namespaceObject



29
30
31
# File 'lib/thrift/definition.rb', line 29

def namespace
  @klass::NAMESPACE
end

#struct_typeObject



37
38
39
# File 'lib/thrift/definition.rb', line 37

def struct_type
  "#{namespace}.#{name}"
end

#structured_annotationsObject



17
18
19
20
21
# File 'lib/thrift/definition.rb', line 17

def structured_annotations
  return [] unless @klass.const_defined? :STRUCTURED_ANNOTATIONS

  @klass::STRUCTURED_ANNOTATIONS
end