Class: Foobara::Manifest::Attributes
Instance Attribute Summary
#base_type, #declaration_data, #is_absolutified, #is_deep_duped, #is_duped, #is_strict, #reference_checked, #type
Instance Method Summary
collapse
#[], #[]=, #all_symbolizable_keys?, #array?, #assign, #class?, #clone, #clone_from_part, #delete, #except, #handle_symbolic_declaration, #hash?, #initialize, #key?, #proc?, #reference?, #size, #slice, #symbolize_keys!, #to_proc
Instance Method Details
#attribute_declarations ⇒ Object
26
27
28
29
30
31
32
33
|
# File 'foobara-0.1.7/projects/manifest/src/foobara/manifest/attributes.rb', line 26
def attribute_declarations
element_type_declarations.keys.to_h do |attribute_name|
[
attribute_name.to_sym,
TypeDeclaration.new(root_manifest, [*path, :element_type_declarations, attribute_name])
]
end
end
|
#attribute_names ⇒ Object
39
40
41
|
# File 'foobara-0.1.7/projects/manifest/src/foobara/manifest/attributes.rb', line 39
def attribute_names
attribute_declarations.keys.map(&:to_s)
end
|
#default_for(attribute_name) ⇒ Object
18
19
20
|
# File 'foobara-0.1.7/projects/manifest/src/foobara/manifest/attributes.rb', line 18
def default_for(attribute_name)
DataPath.value_at([:defaults, attribute_name], attributes_manifest)
end
|
#empty? ⇒ Boolean
35
36
37
|
# File 'foobara-0.1.7/projects/manifest/src/foobara/manifest/attributes.rb', line 35
def empty?
attribute_declarations.empty?
end
|
#has_attribute_declarations? ⇒ Boolean
22
23
24
|
# File 'foobara-0.1.7/projects/manifest/src/foobara/manifest/attributes.rb', line 22
def has_attribute_declarations?
!element_type_declarations.nil?
end
|
#required?(attribute_name) ⇒ Boolean
10
11
12
13
14
15
16
|
# File 'foobara-0.1.7/projects/manifest/src/foobara/manifest/attributes.rb', line 10
def required?(attribute_name)
required = DataPath.value_at(:required, attributes_manifest)
if required
required.include?(attribute_name.to_sym) || required.include?(attribute_name.to_s)
end
end
|