class StixSchemaSpy::ComplexType
Public Class Methods
build(xml, schema)
click to toggle source
Build a new complex type by trying to find special classes and either using those or the generic type
# File lib/stix_schema_spy/models/complex_type.rb, line 23 def self.build(xml, schema) ComplexType.new(xml, schema) end
new(*args)
click to toggle source
Calls superclass method
# File lib/stix_schema_spy/models/complex_type.rb, line 8 def initialize(*args) @attributes = {} @elements = {} @types = {} @special_fields = [] super end
Public Instance Methods
complex?()
click to toggle source
Returns whether or not this type is a complex type
# File lib/stix_schema_spy/models/complex_type.rb, line 28 def complex? true end
enumeration?()
click to toggle source
Complex types can't be enumerations?
# File lib/stix_schema_spy/models/complex_type.rb, line 33 def enumeration? false end
load!()
click to toggle source
# File lib/stix_schema_spy/models/complex_type.rb, line 16 def load! return if @loaded @xml.elements.each {|child| process_field(child) } @loaded = true end
vocab_values()
click to toggle source
Returns a list of possible values for that vocabulary
# File lib/stix_schema_spy/models/complex_type.rb, line 40 def vocab_values type = Schema.find(self.schema.prefix, stix_version).find_type(name.gsub("Vocab", "Enum")) if type type.enumeration_values else raise "Unable to find corresponding enumeration for vocabulary" end end