lib/tapioca/dsl/compilers/protobuf.rb in tapioca-0.10.1 vs lib/tapioca/dsl/compilers/protobuf.rb in tapioca-0.10.2
- old
+ new
@@ -35,11 +35,11 @@
# # typed: strong
# class Cart
# sig { returns(Integer) }
# def customer_id; end
#
- # sig { params(month: Integer).returns(Integer) }
+ # sig { params(value: Integer).returns(Integer) }
# def customer_id=(value); end
#
# sig { returns(Integer) }
# def shop_id; end
#
@@ -167,11 +167,11 @@
end
end
sig do
params(
- descriptor: Google::Protobuf::FieldDescriptor
+ descriptor: Google::Protobuf::FieldDescriptor,
).returns(String)
end
def type_of(descriptor)
case descriptor.type
when :enum
@@ -221,11 +221,11 @@
Field.new(
name: descriptor.name,
type: type,
init_type: "T.nilable(T.any(#{type}, T::Hash[#{key_type}, #{value_type}]))",
- default: "Google::Protobuf::Map.new(#{default_args.join(", ")})"
+ default: "Google::Protobuf::Map.new(#{default_args.join(", ")})",
)
else
elem_type = type_of(descriptor)
type = "Google::Protobuf::RepeatedField[#{elem_type}]"
@@ -234,11 +234,11 @@
Field.new(
name: descriptor.name,
type: type,
init_type: "T.nilable(T.any(#{type}, T::Array[#{elem_type}]))",
- default: "Google::Protobuf::RepeatedField.new(#{default_args.join(", ")})"
+ default: "Google::Protobuf::RepeatedField.new(#{default_args.join(", ")})",
)
end
else
type = type_of(descriptor)
nilable_type = as_nilable_type(type)
@@ -246,11 +246,11 @@
Field.new(
name: descriptor.name,
type: type,
init_type: nilable_type,
- default: "nil"
+ default: "nil",
)
end
end
sig do
@@ -262,31 +262,31 @@
def create_descriptor_method(klass, desc)
field = field_of(desc)
klass.create_method(
field.name,
- return_type: field.type
+ return_type: field.type,
)
klass.create_method(
"#{field.name}=",
parameters: [create_param("value", type: field.type)],
- return_type: "void"
+ return_type: "void",
)
field
end
sig do
params(
klass: RBI::Scope,
- desc: Google::Protobuf::OneofDescriptor
+ desc: Google::Protobuf::OneofDescriptor,
).void
end
def create_oneof_method(klass, desc)
klass.create_method(
desc.name,
- return_type: "T.nilable(Symbol)"
+ return_type: "T.nilable(Symbol)",
)
end
end
end
end