Module: Cloverly::Base
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
- #attributes=(json) ⇒ Object
- #initialize(cloverly_instance) ⇒ Object
- #json=(json) ⇒ Object
- #to_json ⇒ Object
Class Method Details
.included(base) ⇒ Object
21 22 23 24 25 |
# File 'lib/cloverly/base.rb', line 21 def self.included(base) base.extend ClassMethods base.class_eval do end end |
Instance Method Details
#attributes=(json) ⇒ Object
7 8 9 10 11 |
# File 'lib/cloverly/base.rb', line 7 def attributes=(json) json.each do |key, value| self.define_singleton_method(key, -> { value }) end end |
#initialize(cloverly_instance) ⇒ Object
3 4 5 |
# File 'lib/cloverly/base.rb', line 3 def initialize(cloverly_instance) @cloverly_instance = cloverly_instance end |
#json=(json) ⇒ Object
17 18 19 |
# File 'lib/cloverly/base.rb', line 17 def json=(json) @json = json end |
#to_json ⇒ Object
13 14 15 |
# File 'lib/cloverly/base.rb', line 13 def to_json @json end |