lib/google/cloud/firestore/document_snapshot.rb in google-cloud-firestore-0.20.0 vs lib/google/cloud/firestore/document_snapshot.rb in google-cloud-firestore-0.21.0

- old
+ new

@@ -89,11 +89,11 @@ # nyc_ref = nyc_snap.ref # def ref @ref end - alias_method :reference, :ref + alias reference ref ## # The collection the document snapshot belongs to. # # @return [CollectionReference] parent collection. @@ -134,11 +134,11 @@ # def data return nil if missing? Convert.fields_to_hash grpc.fields, ref.client end - alias_method :fields, :data + alias fields data ## # Retrieves the document data. # # @param [FieldPath, String, Symbol] field_path A field path @@ -194,18 +194,19 @@ nodes = field_path.fields.map(&:to_sym) selected_data = data nodes.each do |node| unless selected_data.is_a? Hash - fail ArgumentError, - "#{field_path.formatted_string} is not contained in the data" + err_msg = "#{field_path.formatted_string} is not " \ + "contained in the data" + raise ArgumentError, err_msg end selected_data = selected_data[node] end selected_data end - alias_method :[], :get + alias [] get # @!endgroup ## # The time at which the document was created. @@ -216,11 +217,11 @@ # def created_at return nil if missing? Convert.timestamp_to_time grpc.create_time end - alias_method :create_time, :created_at + alias create_time created_at ## # The time at which the document was last changed. # # This value is initally set to the `created_at` on document creation, @@ -230,11 +231,11 @@ # def updated_at return nil if missing? Convert.timestamp_to_time grpc.update_time end - alias_method :update_time, :updated_at + alias update_time updated_at ## # The time at which the document was read. # # This value is set even if the document does not exist. @@ -242,10 +243,10 @@ # @return [Time] The time the document was read # def read_at @read_at end - alias_method :read_time, :read_at + alias read_time read_at ## # Determines whether the document exists. # # @return [Boolean] Whether the document exists.