Class: ParamsReady::Parameter::EnumSetParameter

Inherits:
AbstractStructParameter show all
Includes:
Marshaller::ParameterModule
Defined in:
lib/params_ready/parameter/enum_set_parameter.rb

Constant Summary

Constants inherited from AbstractStructParameter

AbstractStructParameter::EMPTY_HASH

Instance Attribute Summary

Attributes inherited from AbstractParameter

#definition

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Marshaller::ParameterModule

#marshal

Methods inherited from AbstractStructParameter

#[], #[]=, #find_in_hash, #for_frontend, #for_model, #for_output, #wrap_output

Methods included from ComplexParameter

#update_child

Methods inherited from Parameter

#allows_undefined?, #definite_default?, #eligible_for_output?, #find_in_hash, #format, #format_self_permitted, #freeze, #hash, #hash_key, #initialize, #inspect_content, #is_default?, #is_definite?, #is_nil?, #is_undefined?, #memo, #memo!, #nil_default?, #populate_other, #set_from_input, #set_value, #to_hash_if_eligible, #unwrap, #unwrap_or, #wrap_output

Methods inherited from AbstractParameter

#==, #dup, #initialize, #inspect, intent_for_children, #match?, #populate, #to_hash, #update_if_applicable, #update_in

Methods included from Extensions::Freezer

#freeze_variable, #freeze_variables, #variables_to_freeze

Methods included from FromHash

#set_from_hash

Methods included from Extensions::Freezer::InstanceMethods

#freeze

Constructor Details

This class inherits a constructor from ParamsReady::Parameter::Parameter

Class Method Details

.intent_for_set(intent) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/params_ready/parameter/enum_set_parameter.rb', line 13

def self.intent_for_set(intent)
  Intent.new(
    intent.format.update(
      omit: [],
      remap: false
    ),
    intent.restriction
  )
end

Instance Method Details

#member?(key) ⇒ Boolean

Returns:

  • (Boolean)

Raises:



23
24
25
26
27
28
29
30
31
# File 'lib/params_ready/parameter/enum_set_parameter.rb', line 23

def member?(key)
  raise ParamsReadyError, "Key not defined: '#{key}'" unless definition.has_child? key

  if is_definite?
    bare_value[key].unwrap == true
  else
    false
  end
end