lib/tapioca/dsl/compilers/state_machines.rb in tapioca-0.10.1 vs lib/tapioca/dsl/compilers/state_machines.rb in tapioca-0.10.2

- old
+ new

@@ -184,75 +184,75 @@ sig { params(instance_module: RBI::Module).void } def define_activerecord_methods(instance_module) instance_module.create_method( "changed_for_autosave?", - return_type: "T::Boolean" + return_type: "T::Boolean", ) end sig { params(instance_module: RBI::Module, machine: ::StateMachines::Machine).void } def define_state_methods(instance_module, machine) machine.states.each do |state| instance_module.create_method( "#{state.qualified_name}?", - return_type: "T::Boolean" + return_type: "T::Boolean", ) end end sig { params(instance_module: RBI::Module, machine: ::StateMachines::Machine).void } def define_event_methods(instance_module, machine) machine.events.each do |event| instance_module.create_method( "can_#{event.qualified_name}?", - return_type: "T::Boolean" + return_type: "T::Boolean", ) instance_module.create_method( "#{event.qualified_name}_transition", parameters: [create_rest_param("args", type: "T.untyped")], - return_type: "T.nilable(::StateMachines::Transition)" + return_type: "T.nilable(::StateMachines::Transition)", ) instance_module.create_method( event.qualified_name.to_s, parameters: [create_rest_param("args", type: "T.untyped")], - return_type: "T::Boolean" + return_type: "T::Boolean", ) instance_module.create_method( "#{event.qualified_name}!", parameters: [create_rest_param("args", type: "T.untyped")], - return_type: "T::Boolean" + return_type: "T::Boolean", ) end end sig do params( instance_module: RBI::Module, machine: ::StateMachines::Machine, - state_type: String + state_type: String, ).void end def define_state_accessor(instance_module, machine, state_type) attribute = machine.attribute.to_s instance_module.create_method( attribute, - return_type: state_type + return_type: state_type, ) instance_module.create_method( "#{attribute}=", parameters: [create_param("value", type: state_type)], - return_type: state_type + return_type: state_type, ) end sig { params(instance_module: RBI::Module, machine: ::StateMachines::Machine).void } def define_state_predicate(instance_module, machine) instance_module.create_method( "#{machine.name}?", parameters: [create_param("state", type: "T.any(String, Symbol)")], - return_type: "T::Boolean" + return_type: "T::Boolean", ) end sig { params(instance_module: RBI::Module, machine: ::StateMachines::Machine).void } def define_event_helpers(instance_module, machine) @@ -262,43 +262,43 @@ event_transition_attribute = machine.attribute(:event_transition).to_s instance_module.create_method( events_attribute, parameters: [create_rest_param("args", type: "T.untyped")], - return_type: "T::Array[T.any(String, Symbol)]" + return_type: "T::Array[T.any(String, Symbol)]", ) instance_module.create_method( transitions_attribute, parameters: [create_rest_param("args", type: "T.untyped")], - return_type: "T::Array[::StateMachines::Transition]" + return_type: "T::Array[::StateMachines::Transition]", ) instance_module.create_method( "fire_#{event_attribute}", parameters: [ create_param("event", type: "T.any(String, Symbol)"), create_rest_param("args", type: "T.untyped"), ], - return_type: "T::Boolean" + return_type: "T::Boolean", ) if machine.action instance_module.create_method( event_attribute, - return_type: "T.nilable(Symbol)" + return_type: "T.nilable(Symbol)", ) instance_module.create_method( "#{event_attribute}=", parameters: [create_param("value", type: "T.any(String, Symbol)")], - return_type: "T.any(String, Symbol)" + return_type: "T.any(String, Symbol)", ) instance_module.create_method( event_transition_attribute, - return_type: "T.nilable(::StateMachines::Transition)" + return_type: "T.nilable(::StateMachines::Transition)", ) instance_module.create_method( "#{event_transition_attribute}=", parameters: [create_param("value", type: "::StateMachines::Transition")], - return_type: "::StateMachines::Transition" + return_type: "::StateMachines::Transition", ) end end sig { params(instance_module: RBI::Module, machine: ::StateMachines::Machine).void } @@ -306,42 +306,42 @@ paths_attribute = machine.attribute(:paths).to_s instance_module.create_method( paths_attribute, parameters: [create_rest_param("args", type: "T.untyped")], - return_type: "T::Array[::StateMachines::Transition]" + return_type: "T::Array[::StateMachines::Transition]", ) end sig do params( instance_module: RBI::Module, class_module: RBI::Module, - machine: ::StateMachines::Machine + machine: ::StateMachines::Machine, ).void end def define_name_helpers(instance_module, class_module, machine) name_attribute = machine.attribute(:name).to_s event_name_attribute = machine.attribute(:event_name).to_s class_module.create_method( "human_#{name_attribute}", parameters: [create_param("state", type: "T.any(String, Symbol)")], - return_type: "String" + return_type: "String", ) class_module.create_method( "human_#{event_name_attribute}", parameters: [create_param("event", type: "T.any(String, Symbol)")], - return_type: "String" + return_type: "String", ) instance_module.create_method( name_attribute, - return_type: "T.any(String, Symbol)" + return_type: "T.any(String, Symbol)", ) instance_module.create_method( "human_#{name_attribute}", - return_type: "String" + return_type: "String", ) end sig { params(class_module: RBI::Module, machine: ::StateMachines::Machine).void } def define_scopes(class_module, machine) @@ -352,10 +352,10 @@ .select { |method| method.to_s.start_with?("with_", "without_") } .each do |method| class_module.create_method( method.to_s, parameters: [create_rest_param("states", type: "T.any(String, Symbol)")], - return_type: "T.untyped" + return_type: "T.untyped", ) end end end end