Class: Skit::JsonSchema::Definitions::TuplePropertyType
- Inherits:
-
Object
- Object
- Skit::JsonSchema::Definitions::TuplePropertyType
- Extended by:
- T::Sig
- Defined in:
- lib/skit/json_schema/definitions/tuple_property_type.rb
Instance Attribute Summary collapse
-
#item_types ⇒ Object
readonly
Returns the value of attribute item_types.
-
#nullable ⇒ Object
readonly
Returns the value of attribute nullable.
Instance Method Summary collapse
-
#initialize(item_types:, nullable: false) ⇒ TuplePropertyType
constructor
A new instance of TuplePropertyType.
- #to_sorbet_type ⇒ Object
- #with_nullable ⇒ Object
Constructor Details
#initialize(item_types:, nullable: false) ⇒ TuplePropertyType
Returns a new instance of TuplePropertyType.
17 18 19 20 |
# File 'lib/skit/json_schema/definitions/tuple_property_type.rb', line 17 def initialize(item_types:, nullable: false) @item_types = item_types @nullable = nullable end |
Instance Attribute Details
#item_types ⇒ Object (readonly)
Returns the value of attribute item_types.
11 12 13 |
# File 'lib/skit/json_schema/definitions/tuple_property_type.rb', line 11 def item_types @item_types end |
#nullable ⇒ Object (readonly)
Returns the value of attribute nullable.
14 15 16 |
# File 'lib/skit/json_schema/definitions/tuple_property_type.rb', line 14 def nullable @nullable end |
Instance Method Details
#to_sorbet_type ⇒ Object
23 24 25 26 |
# File 'lib/skit/json_schema/definitions/tuple_property_type.rb', line 23 def to_sorbet_type tuple_type = "[#{@item_types.map(&:to_sorbet_type).join(", ")}]" nullable ? "T.nilable(#{tuple_type})" : tuple_type end |
#with_nullable ⇒ Object
29 30 31 |
# File 'lib/skit/json_schema/definitions/tuple_property_type.rb', line 29 def with_nullable TuplePropertyType.new(item_types: @item_types, nullable: true) end |