Class: RecordEncoder::Bert
- Inherits:
-
Object
- Object
- RecordEncoder::Bert
- Defined in:
- lib/record_encoder/bert.rb
Constant Summary collapse
- SUPPORTED_OPTIONS =
i( primary_key delete_primary_key )
Instance Method Summary collapse
-
#initialize(klass, *attributes) ⇒ Bert
constructor
A new instance of Bert.
- #to_bert ⇒ Object
Constructor Details
#initialize(klass, *attributes) ⇒ Bert
Returns a new instance of Bert.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/record_encoder/bert.rb', line 12 def initialize klass, *attributes @klass = klass raise "klass can't be blank!" if @klass.blank? raise "klass must be a Class!" unless @klass.is_a? Class = attributes..slice!(SUPPORTED_OPTIONS) @primary_key = [:primary_key] || :id @delete_primary_key = [:delete_primary_key] || true bert_prefix_and_suffix end |
Instance Method Details
#to_bert ⇒ Object
24 25 26 27 |
# File 'lib/record_encoder/bert.rb', line 24 def to_bert to_bert_internal {|r| yield r } nil end |