Class: Fortnox::Struct

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/fortnox/struct.rb

Class Method Summary collapse

Class Method Details

.attribute(name, type, *flags) ⇒ Object



13
14
15
16
# File 'lib/fortnox/struct.rb', line 13

def attribute(name, type, *flags)
  read_only_attributes << name if flags.include?(:read_only)
  super(name, type)
end

.attribute?(name, type, *flags) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
21
# File 'lib/fortnox/struct.rb', line 18

def attribute?(name, type, *flags)
  read_only_attributes << name if flags.include?(:read_only)
  super(name, type)
end

.read_only_attributesObject



8
9
10
11
# File 'lib/fortnox/struct.rb', line 8

def read_only_attributes
  @read_only_attributes ||=
    (superclass.respond_to?(:read_only_attributes) ? superclass.read_only_attributes.dup : [])
end