@@ -6,21 +6,23 @@ class Formatter
66 #: Integer?
77 attr_accessor :max_line_length
88
9- #: (?add_sig_templates: bool, ?group_nodes: bool, ?max_line_length: Integer?, ?nest_singleton_methods: bool, ?nest_non_public_members: bool, ?sort_nodes: bool) -> void
9+ #: (?add_sig_templates: bool, ?group_nodes: bool, ?max_line_length: Integer?, ?nest_singleton_methods: bool, ?nest_non_public_members: bool, ?sort_nodes: bool, ?replace_attributes_with_methods: bool ) -> void
1010 def initialize (
1111 add_sig_templates : false ,
1212 group_nodes : false ,
1313 max_line_length : nil ,
1414 nest_singleton_methods : false ,
1515 nest_non_public_members : false ,
16- sort_nodes : false
16+ sort_nodes : false ,
17+ replace_attributes_with_methods : false
1718 )
1819 @add_sig_templates = add_sig_templates
1920 @group_nodes = group_nodes
2021 @max_line_length = max_line_length
2122 @nest_singleton_methods = nest_singleton_methods
2223 @nest_non_public_members = nest_non_public_members
2324 @sort_nodes = sort_nodes
25+ @replace_attributes_with_methods = replace_attributes_with_methods
2426 end
2527
2628 #: (RBI::File file) -> String
@@ -36,6 +38,7 @@ def format_file(file)
3638
3739 #: (RBI::Tree tree) -> void
3840 def format_tree ( tree )
41+ tree . replace_attributes_with_methods! if @replace_attributes_with_methods
3942 tree . add_sig_templates! if @add_sig_templates
4043 tree . nest_singleton_methods! if @nest_singleton_methods
4144 tree . nest_non_public_members! if @nest_non_public_members
0 commit comments