Class: Eco::API::Organization::PersonSchemas
Constant Summary
Language::Models::Collection::BASIC_METHODS, Language::Models::Collection::EXTENDED_METHODS
Instance Method Summary
collapse
#<, #<<, #attr, #attr?, attr_collection, attr_presence, #attrs, attrs_create_method, #contains, #delete!, #each, #empty, #empty?, #exclude, #group_by, #length, #merge, #new, #newFrom, #present, #present_all?, #present_some?, #remove, #to_c, #to_h, #unique_attrs, #update
Constructor Details
#initialize(schemas = [], klass: Ecoportal::API::Internal::PersonSchema) ⇒ PersonSchemas
Returns a new instance of PersonSchemas.
8
9
10
11
12
13
|
# File 'lib/eco/api/organization/person_schemas.rb', line 8
def initialize(schemas = [], klass: Ecoportal::API::Internal::PersonSchema)
@klass = Ecoportal::API::Internal::PersonSchema
@caches_init = false
super(schemas, klass: @klass)
init_caches
end
|
Instance Method Details
#[](id_name) ⇒ Object
34
35
36
|
# File 'lib/eco/api/organization/person_schemas.rb', line 34
def [](id_name)
@by_id[schema_id(id_name)]
end
|
#schema(id_name) ⇒ Object
30
31
32
|
# File 'lib/eco/api/organization/person_schemas.rb', line 30
def schema(id_name)
self[id_name]
end
|
#to_id(name) ⇒ Object
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/eco/api/organization/person_schemas.rb', line 15
def to_id(name)
case name
when Enumerable
name.map do |n|
schema(n)&.id
end.compact
else
schema(name)&.id
end
end
|
#to_name(id) ⇒ Object
26
27
28
|
# File 'lib/eco/api/organization/person_schemas.rb', line 26
def to_name(id)
schema(id)&.name
end
|