Skip to content

Commit

Permalink
Correct minor typos
Browse files Browse the repository at this point in the history
  • Loading branch information
beauby authored and bf4 committed Oct 15, 2015
1 parent 1b00063 commit 60df36b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions lib/active_model/serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def self.attribute(attr, options = {})

# @api private
# Used by FragmentCache on the CachedSerializer
# to call attribute methods on the fragmented cached serializer
# to call attribute methods on the fragmented cached serializer.
def self.fragmented(serializer)
self._fragmented = serializer
end
Expand Down Expand Up @@ -159,7 +159,7 @@ def self.adapter
end

# Used to cache serializer name => serializer class
# when looked up by Serializer.get_serializer_for
# when looked up by Serializer.get_serializer_for.
def self.serializers_cache
@serializers_cache ||= ThreadSafe::Cache.new
end
Expand Down Expand Up @@ -207,8 +207,8 @@ def self.get_serializer_for(klass)
attr_accessor :object, :root, :scope

# `scope_name` is set as :current_user by default in the controller.
# If the instance does not have a method nameed `scope_name`, it
# defines the method so that calls the +scope+.
# If the instance does not have a method named `scope_name`, it
# defines the method so that it calls the +scope+.
def initialize(object, options = {})
self.object = object
self.instance_options = options
Expand All @@ -223,7 +223,7 @@ def initialize(object, options = {})
end
end

# Used by adapter as resource root
# Used by adapter as resource root.
def json_key
root || object.class.model_name.to_s.underscore
end
Expand Down
18 changes: 9 additions & 9 deletions lib/active_model/serializer/adapter/fragment_cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ def initialize(adapter, serializer, options)

# TODO: Use Serializable::Resource
# TODO: call +constantize+ less
# 1. Create a CachedSerializer and NonCachedSerializer from the serializer class.
# 2. Serialize the above two with the given adapter.
# 3. Pass their serializations to the adapter +::fragment_cache+.
# 1. Create a CachedSerializer and NonCachedSerializer from the serializer class
# 2. Serialize the above two with the given adapter
# 3. Pass their serializations to the adapter +::fragment_cache+
def fetch
klass = serializer.class
# It will split the serializer into two, one that will be cached and other wont
# It will split the serializer into two, one that will be cached and one that will not
serializers = fragment_serializer(serializer.object.class.name, klass)

# Instantiate both serializers
Expand All @@ -41,9 +41,9 @@ def fetch

private

# Given a serializer class and a hash of its cached and non0cached serializers
# 1. Determine cached attributes from serializer class options.
# 2. Add cached attributes to cached Serializer.
# Given a serializer class and a hash of its cached and non-cached serializers
# 1. Determine cached attributes from serializer class options
# 2. Add cached attributes to cached Serializer
# 3. Add non-cached attributes to non-cached Serializer
def cached_attributes(klass, serializers)
attributes = serializer.class._attributes
Expand All @@ -66,8 +66,8 @@ def cached_attributes(klass, serializers)
end

# Given a resource name and its serializer's class
# 1. Dyanmically creates a CachedSerializer and NonCachedSerializer
# for a given class 'name'.
# 1. Dyanmically creates a CachedSerializer and NonCachedSerializer
# for a given class 'name'
# 2. Call
# CachedSerializer.cache(serializer._cache_options)
# CachedSerializer.fragmented(serializer)
Expand Down

0 comments on commit 60df36b

Please sign in to comment.