Skip to content

Commit bf8270b

Browse files
committed
Document Serializer settings and private api [ci skip]
1 parent 386a567 commit bf8270b

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

lib/active_model/serializer/attributes.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module ActiveModel
22
class Serializer
33
module Attributes
4+
# @api private
45
class Attribute
56
delegate :call, to: :reader
67

@@ -19,12 +20,14 @@ def self.build(name, block)
1920
end
2021
end
2122
end
23+
# @api private
2224
class AttributeReader < Attribute
2325
def initialize(name)
2426
super(name)
2527
@reader = ->(instance) { instance.read_attribute_for_serialization(name) }
2628
end
2729
end
30+
# @api private
2831
class AttributeBlock < Attribute
2932
def initialize(name, block)
3033
super(name)

lib/active_model/serializer/reflection.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ def initialize(*)
3535
@reader = self.class.build_reader(name, block)
3636
end
3737

38+
# @api private
3839
def value(instance)
3940
call(instance)
4041
end
4142

43+
# @api private
4244
def self.build_reader(name, block)
4345
if block
4446
->(instance) { instance.read_attribute_for_serialization(name).instance_eval(&block) }

0 commit comments

Comments
 (0)