lib/spaceship/base.rb in spaceship-0.4.0 vs lib/spaceship/base.rb in spaceship-0.5.0

- old
+ new

@@ -60,14 +60,16 @@ end ## # Sets client and returns self for chaining. # @return (Spaceship::Base) + # rubocop:disable Style/AccessorMethodName def set_client(client) self.client = client self end + # rubocop:enable Style/AccessorMethodName ## # Binds attributes getters and setters to underlying data returned from the API. # Setting any properties will alter the `raw_data` hash. # @@ -141,21 +143,25 @@ # ProvisioningProfile.some_other_method # #=> NoMethodError: undefined method `some_other_method' for ProvisioningProfile def method_missing(method_sym, *args, &block) module_name = method_sym.to_s module_name.sub!(/^[a-z\d]/) { $&.upcase } - module_name.gsub!(/(?:_|(\/))([a-z\d])/) { $2.upcase } + module_name.gsub!(%r{(?:_|(/))([a-z\d])}) { $2.upcase } if const_defined?(module_name) klass = const_get(module_name) klass.set_client(@client) else super end end end ## + # @return (Spaceship::Client) The current spaceship client used by the model to make requests. + attr_reader :client + + ## # @return (Hash/Array) Holds the raw data we got from Apple's # server to use it later attr_accessor :raw_data ## @@ -173,15 +179,9 @@ end # This method can be used by subclasses to do additional initialisation # using the `raw_data` def setup - end - - ## - # @return (Spaceship::Client) The current spaceship client used by the model to make requests. - def client - @client end ##################################################### # @!group Storing the `attr_accessor` #####################################################