mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Getting started: attributes.
Super super basic collection of attributes. Nothing fancy.
This commit is contained in:
21
lib/active_model/serializer.rb
Normal file
21
lib/active_model/serializer.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
module ActiveModel
|
||||
class Serializer
|
||||
class << self
|
||||
attr_accessor :_attributes
|
||||
end
|
||||
|
||||
def self.inherited(base)
|
||||
base._attributes = []
|
||||
end
|
||||
|
||||
def self.attributes(*attrs)
|
||||
@_attributes.concat attrs
|
||||
end
|
||||
|
||||
attr_accessor :object
|
||||
|
||||
def initialize(object)
|
||||
@object = object
|
||||
end
|
||||
end
|
||||
end
|
||||
5
lib/active_model/serializer/version.rb
Normal file
5
lib/active_model/serializer/version.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
module ActiveModel
|
||||
class Serializer
|
||||
VERSION = "0.9.0"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user