Class: Odca::SchemaBase
- Inherits:
-
Object
show all
- Extended by:
- Forwardable
- Defined in:
- lib/odca/schema_base.rb
Defined Under Namespace
Classes: Attribute, Header
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(header) ⇒ SchemaBase
Returns a new instance of SchemaBase.
10
11
12
13
|
# File 'lib/odca/schema_base.rb', line 10
def initialize()
@attributes = []
@header =
end
|
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
6
7
8
|
# File 'lib/odca/schema_base.rb', line 6
def attributes
@attributes
end
|
Returns the value of attribute header.
6
7
8
|
# File 'lib/odca/schema_base.rb', line 6
def
@header
end
|
Instance Method Details
#add_attribute(attribute) ⇒ Object
24
25
26
|
# File 'lib/odca/schema_base.rb', line 24
def add_attribute(attribute)
attributes << attribute
end
|
#pii_attributes ⇒ Object
28
29
30
|
# File 'lib/odca/schema_base.rb', line 28
def pii_attributes
attributes.select(&:pii?)
end
|
#to_h ⇒ Object
15
16
17
18
19
20
21
22
|
# File 'lib/odca/schema_base.rb', line 15
def to_h
.to_h.merge(
attributes: attributes.each_with_object({}) do |attr, memo|
memo[attr.name] = attr.type
end,
pii_attributes: pii_attributes.map(&:name)
)
end
|
#to_json(*options) ⇒ Object
32
33
34
|
# File 'lib/odca/schema_base.rb', line 32
def to_json(*options)
to_h.to_json(*options)
end
|