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
-
#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.
22 23 24 |
# File 'lib/odata_duty/complex_type.rb', line 22 def initialize(complex_type) @complex_type = complex_type end |
Instance Attribute Details
#complex_type ⇒ Object (readonly)
Returns the value of attribute complex_type.
20 21 22 |
# File 'lib/odata_duty/complex_type.rb', line 20 def complex_type @complex_type end |
Instance Method Details
#metadata_type ⇒ Object
38 39 40 |
# File 'lib/odata_duty/complex_type.rb', line 38 def :complex end |
#metadata_types(visited = []) ⇒ Object
callers uniq the result, so duplicates from repeated property types are fine
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/odata_duty/complex_type.rb', line 43 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
30 31 32 |
# File 'lib/odata_duty/complex_type.rb', line 30 def name complex_type.to_s.split('::').last.sub(/ComplexType\z/, '').sub(/Complex\z/, '') end |
#properties ⇒ Object
26 27 28 |
# File 'lib/odata_duty/complex_type.rb', line 26 def properties complex_type.properties end |
#property_type ⇒ Object
34 35 36 |
# File 'lib/odata_duty/complex_type.rb', line 34 def property_type name end |
#scalar? ⇒ Boolean
nil (falsy) rather than false: callers only consume truthiness
55 |
# File 'lib/odata_duty/complex_type.rb', line 55 def scalar?; end |