Class: LHS::Record
- Inherits:
-
Object
show all
- Includes:
- Inspect, Pagination, Batch, Chainable, Configuration, Create, CustomSetters, Destroy, Endpoints, Equality, Find, FindBy, First, Last, Mapping, Model, Relations, Request, RequestCycleCache, Scope
- Defined in:
- lib/lhs/record.rb,
lib/lhs/concerns/record/find.rb,
lib/lhs/concerns/record/last.rb,
lib/lhs/concerns/record/batch.rb,
lib/lhs/concerns/record/first.rb,
lib/lhs/concerns/record/model.rb,
lib/lhs/concerns/record/scope.rb,
lib/lhs/concerns/record/create.rb,
lib/lhs/concerns/record/destroy.rb,
lib/lhs/concerns/record/find_by.rb,
lib/lhs/concerns/record/mapping.rb,
lib/lhs/concerns/record/request.rb,
lib/lhs/concerns/record/equality.rb,
lib/lhs/concerns/record/chainable.rb,
lib/lhs/concerns/record/endpoints.rb,
lib/lhs/concerns/record/relations.rb,
lib/lhs/concerns/record/pagination.rb,
lib/lhs/concerns/record/configuration.rb,
lib/lhs/concerns/record/custom_setters.rb,
lib/lhs/concerns/record/request_cycle_cache/interceptor.rb,
lib/lhs/concerns/record/request_cycle_cache/request_cycle_thread_registry.rb
Defined Under Namespace
Modules: Batch, Chainable, Configuration, Create, CustomSetters, Destroy, Endpoints, Equality, Find, FindBy, First, Last, Mapping, Model, Pagination, Relations, Request, RequestCycleCache, Scope
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Model
#persisted?, #to_model
Methods included from Inspect
#inspect
Methods included from Equality
#==
Methods included from Chainable
#options
Constructor Details
#initialize(data = nil, apply_customer_setters = true) ⇒ Record
71
72
73
74
75
76
|
# File 'lib/lhs/record.rb', line 71
def initialize(data = nil, apply_customer_setters = true)
data ||= LHS::Data.new({}, nil, self.class)
data = LHS::Data.new(data, nil, self.class) unless data.is_a?(LHS::Data)
define_singleton_method(:_data) { data }
apply_custom_setters! if apply_customer_setters
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
88
89
90
|
# File 'lib/lhs/record.rb', line 88
def method_missing(name, *args, &block)
_data.send(name, *args, &block)
end
|
Class Method Details
.build(data = nil) ⇒ Object
82
83
84
|
# File 'lib/lhs/record.rb', line 82
def self.build(data = nil)
new(data)
end
|
Instance Method Details
#as_json(options = nil) ⇒ Object
78
79
80
|
# File 'lib/lhs/record.rb', line 78
def as_json(options = nil)
_data.as_json(options)
end
|