Module: Fluxo::Operation::Attributes::ClassMethods

Defined in:
lib/fluxo/operation/attributes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#strict_attributes=(value) ⇒ Object (writeonly)

When set to true, the operation will not validate attributes definition before calling the operation.



17
18
19
# File 'lib/fluxo/operation/attributes.rb', line 17

def strict_attributes=(value)
  @strict_attributes = value
end

#strict_transient_attributes=(value) ⇒ Object (writeonly)

When set to true, the operation will not validate the transient_attributes defition during the flow step execution.



14
15
16
# File 'lib/fluxo/operation/attributes.rb', line 14

def strict_transient_attributes=(value)
  @strict_transient_attributes = value
end

#validations_proxyObject (readonly)

Returns the value of attribute validations_proxy.



11
12
13
# File 'lib/fluxo/operation/attributes.rb', line 11

def validations_proxy
  @validations_proxy
end

Instance Method Details

#attribute?(key) ⇒ Boolean

Returns:

  • (Boolean)


55
56
57
58
59
# File 'lib/fluxo/operation/attributes.rb', line 55

def attribute?(key)
  return false unless key

  attribute_names.include?(key.to_sym)
end

#attribute_namesObject



35
36
37
# File 'lib/fluxo/operation/attributes.rb', line 35

def attribute_names
  @attribute_names ||= []
end

#attributes(*names) ⇒ Object



43
44
45
46
47
# File 'lib/fluxo/operation/attributes.rb', line 43

def attributes(*names)
  @attribute_names ||= []
  names = names.map(&:to_sym) - @attribute_names
  @attribute_names.push(*names)
end

#strict_attributes?Boolean

Returns:

  • (Boolean)


19
20
21
22
23
# File 'lib/fluxo/operation/attributes.rb', line 19

def strict_attributes?
  return @strict_attributes if defined?(@strict_attributes)

  Fluxo.config.strict_attributes
end

#strict_transient_attributes?Boolean

Returns:

  • (Boolean)


25
26
27
28
29
# File 'lib/fluxo/operation/attributes.rb', line 25

def strict_transient_attributes?
  return @strict_transient_attributes if defined?(@strict_transient_attributes)

  Fluxo.config.strict_transient_attributes
end

#transient_attribute?(key) ⇒ Boolean

Returns:

  • (Boolean)


61
62
63
64
65
# File 'lib/fluxo/operation/attributes.rb', line 61

def transient_attribute?(key)
  return false unless key

  transient_attribute_names.include?(key.to_sym)
end

#transient_attribute_namesObject



39
40
41
# File 'lib/fluxo/operation/attributes.rb', line 39

def transient_attribute_names
  @transient_attribute_names ||= []
end

#transient_attributes(*names) ⇒ Object



49
50
51
52
53
# File 'lib/fluxo/operation/attributes.rb', line 49

def transient_attributes(*names)
  @transient_attribute_names ||= []
  names = names.map(&:to_sym) - @transient_attribute_names
  @transient_attribute_names.push(*names)
end

#validationsObject

Raises:

  • (NotImplementedError)


31
32
33
# File 'lib/fluxo/operation/attributes.rb', line 31

def validations
  raise NotImplementedError, "ActiveModel is not defined to use validations."
end