Class: Praxis::BlueprintAttributeGroup

Inherits:
Blueprint
  • Object
show all
Defined in:
lib/praxis/blueprint_attribute_group.rb

Instance Attribute Summary

Attributes inherited from Blueprint

#object, #validating

Class Method Summary collapse

Methods inherited from Blueprint

#_cache_key, _finalize!, #_get_attr, as_json_schema, attributes, cache, cache=, caching_enabled=, caching_enabled?, check_option!, default_fieldset, define_attribute!, define_reader!, define_readers!, domain_model, dump, example, family, generate_default_fieldset!, inherited, #initialize, json_schema_type, load, new, parse_default_fieldset, #render, resolve_domain_model!, #to_h, valid_type?, validate, #validate, view

Methods included from Finalizable

#_finalize!, extended, #finalizable, #finalize!, #finalized?, #inherited

Constructor Details

This class inherits a constructor from Praxis::Blueprint

Class Method Details

.construct(attribute_definition, options = {}) ⇒ Object

Construct a new subclass, using attribute_definition to define attributes.



10
11
12
13
14
15
16
17
# File 'lib/praxis/blueprint_attribute_group.rb', line 10

def self.construct(attribute_definition, options = {})
  return self if attribute_definition.nil?

  # Construct a group-derived class with the given mediatype as the reference
  ::Class.new(self) do
    attributes(**options, &attribute_definition)
  end
end

.constructable?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/praxis/blueprint_attribute_group.rb', line 5

def self.constructable?
  true
end

.for(media_type) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/praxis/blueprint_attribute_group.rb', line 19

def self.for(media_type)
  return media_type::AttributeGrouping if defined?(media_type::AttributeGrouping) # Cache the grouping class

  ::Class.new(self) do
    @media_type = media_type
  end
end