Class: OdataDuty::ComplexType::Metadata
- Inherits:
-
Object
- Object
- OdataDuty::ComplexType::Metadata
- Defined in:
- lib/odata_duty/complex_type.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#complex_type ⇒ Object
readonly
Returns the value of attribute complex_type.
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(complex_type) ⇒ Metadata
constructor
A new instance of Metadata.
- #metadata_type ⇒ Object
-
#metadata_types(visited = []) ⇒ Object
callers uniq the result, so duplicates from repeated property types are fine.
- #name ⇒ Object
- #properties ⇒ Object
- #property_type ⇒ Object
-
#scalar? ⇒ Boolean
nil (falsy) rather than false: callers only consume truthiness.
Constructor Details
#initialize(complex_type) ⇒ Metadata
Returns a new instance of Metadata.
27 28 29 |
# File 'lib/odata_duty/complex_type.rb', line 27 def initialize(complex_type) @complex_type = complex_type end |
Instance Attribute Details
#complex_type ⇒ Object (readonly)
Returns the value of attribute complex_type.
25 26 27 |
# File 'lib/odata_duty/complex_type.rb', line 25 def complex_type @complex_type end |
Instance Method Details
#description ⇒ Object
43 44 45 |
# File 'lib/odata_duty/complex_type.rb', line 43 def description complex_type.description end |
#metadata_type ⇒ Object
47 48 49 |
# File 'lib/odata_duty/complex_type.rb', line 47 def :complex end |
#metadata_types(visited = []) ⇒ Object
callers uniq the result, so duplicates from repeated property types are fine
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/odata_duty/complex_type.rb', line 52 def (visited = []) return [] if visited.include?(complex_type) visited << complex_type raw_types = properties.map(&:raw_type) nested = raw_types.grep(Metadata).flat_map { |m| m.(visited) } [complex_type] + nested + raw_types.grep(EnumType::Metadata).map(&:enum_type) end |
#name ⇒ Object
35 36 37 |
# File 'lib/odata_duty/complex_type.rb', line 35 def name complex_type.to_s.split('::').last.sub(/ComplexType\z/, '').sub(/Complex\z/, '') end |
#properties ⇒ Object
31 32 33 |
# File 'lib/odata_duty/complex_type.rb', line 31 def properties complex_type.properties end |
#property_type ⇒ Object
39 40 41 |
# File 'lib/odata_duty/complex_type.rb', line 39 def property_type name end |
#scalar? ⇒ Boolean
nil (falsy) rather than false: callers only consume truthiness
64 |
# File 'lib/odata_duty/complex_type.rb', line 64 def scalar?; end |