Module: Handlebarer::Serialize::ClassMethods
- Defined in:
- lib/handlebarer/serialize.rb
Instance Method Summary collapse
-
#hbs_serializable(*args) ⇒ Object
Enable serialization on ActiveModel classes.
Instance Method Details
#hbs_serializable(*args) ⇒ Object
Enable serialization on ActiveModel classes
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/handlebarer/serialize.rb', line 16 def hbs_serializable(*args) serialize = { :attrs => [], :merge => true } args.each do |arg| if arg.is_a? Symbol serialize[:attrs] << arg elsif arg.is_a? Hash serialize[:merge] = arg[:merge] if arg.include?(:merge) end end class_variable_set(:@@serialize, serialize) end |