Class: BBLib::LazyClass
- Inherits:
-
Object
- Object
- BBLib::LazyClass
- Defined in:
- lib/object/lazy_class.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(*args) ⇒ LazyClass
constructor
A new instance of LazyClass.
- #serialize ⇒ Object
Methods included from Hooks
add_after_hook, add_before_hook, after, after_hooked_methods, after_hooks, after_hooks_for, before, before_hooked_methods, before_hooks, before_hooks_for, method_added
Constructor Details
#initialize(*args) ⇒ LazyClass
Returns a new instance of LazyClass.
9 10 11 12 13 |
# File 'lib/object/lazy_class.rb', line 9 def initialize *args _pre_setup lazy_setup _lazy_init(*args) end |
Instance Method Details
#serialize ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/object/lazy_class.rb', line 15 def serialize _serialize_fields.map do |name, h| value = send(h[:method]) if !h[:always] && value == h[:ignore] nil else [ name, value ] end end.reject(&:nil?).to_h end |