CocoaPods / Xcodeproj

Create and modify Xcode projects from Ruby.
http://rubygems.org/gems/xcodeproj
MIT License
2.37k stars 458 forks source link

Remove all methods that start with `set_` #214

Open alloy opened 10 years ago

alloy commented 10 years ago

There are tons of methods that are using the form set_foo, which is not idiomatic Ruby, these should be using the form foo= instead.

fabiopelosin commented 10 years ago

Note that the set_ convention is used to denote when the setter is decorated with further behaviour

def set_source_tree(object, source_tree)
  source_tree = normalize_source_tree(source_tree)
  object.source_tree = source_tree
end

form https://github.com/CocoaPods/Xcodeproj/blob/031daccd94d5446f8732c59d1b75e4949b9fe55f/lib/xcodeproj/project/object/helpers/groupable_helper.rb#L150-L153

alloy commented 10 years ago

I don’t think the user of the API should need to know of that, though. After that, it just looks like Java or Objective-C before dot-notation :D

fabiopelosin commented 10 years ago

Good point… for the record, the is also another intent: to not override the dynamically generated setters for the Xcodeproj’s attributes.

alloy commented 10 years ago

Fair enough, but we should really just be using super or something like write_attribute(name, value) like in ActiveRecord. Obviously the former would be much nicer.

fabiopelosin commented 10 years ago

:+1: