Class: Marty::Base
Direct Known Subclasses
ApiAuth, ApiConfig, Marty::BackgroundJob::Log, Marty::BackgroundJob::Schedule, BaseRule, Config, DataGrid, Diagnostic::Collection, Diagnostic::Connections, Diagnostic::DelayedJobVersion, Diagnostic::DelayedJobWorkers, Diagnostic::EnvironmentVariables, Diagnostic::Fatal, Diagnostic::Nodes, Diagnostic::ScheduledJobs, Diagnostic::Version, EnumEventOperation, EnumPromiseType, GridIndexBoolean, GridIndexInt4range, GridIndexInteger, GridIndexNumrange, GridIndexString, ImportType, Log, Notifications::Config, Notifications::Delivery, Notifications::EventType, Notifications::Notification, Posting, PostingType, Promise, RoleType, Script, Tag, Token, User, UserRole, VwPromise
Class Attribute Summary collapse
Class Method Summary
collapse
joins, old_joins
Class Attribute Details
.struct_attrs ⇒ Object
Returns the value of attribute struct_attrs.
6
7
8
|
# File 'app/models/marty/base.rb', line 6
def struct_attrs
@struct_attrs
end
|
Class Method Details
.get_final_attrs ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'app/models/marty/base.rb', line 20
def get_final_attrs
final_attrs = get_struct_attrs
return final_attrs if final_attrs.present?
raise "Marty::Base: no attributes for #{self}"
end
|
.get_struct_attrs ⇒ Object
8
9
10
11
12
13
|
# File 'app/models/marty/base.rb', line 8
def get_struct_attrs
self.struct_attrs ||=
attribute_names - Mcfly::COLUMNS.to_a -
(const_defined?('MCFLY_UNIQUENESS') &&
const_get('MCFLY_UNIQUENESS') || []).map(&:to_s)
end
|
.make_hash(inst) ⇒ Object
43
44
45
46
|
# File 'app/models/marty/base.rb', line 43
def make_hash(inst)
fa = get_final_attrs
inst.attributes.slice(*fa)
end
|
.make_openstruct(inst) ⇒ Object
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'app/models/marty/base.rb', line 48
def make_openstruct(inst)
return nil unless inst
fa = get_final_attrs
os = OpenStruct.new(inst.attributes.slice(*fa))
if self == Marty::DataGrid
def os.lookup_grid_distinct_entry(pt, params)
dgh = to_h.stringify_keys.slice(
'id', 'group_id', 'created_dt', 'metadata', 'data_type')
Marty::DataGrid.lookup_grid_distinct_entry_h(pt, params, dgh)
end
end
os
end
|
.mcfly_pt(pt) ⇒ Object
15
16
17
18
|
# File 'app/models/marty/base.rb', line 15
def mcfly_pt(pt)
tb = table_name
where("#{tb}.obsoleted_dt >= ? AND #{tb}.created_dt < ?", pt, pt)
end
|