Class: Uinit::Structure::Attribute
- Inherits:
-
Object
- Object
- Uinit::Structure::Attribute
- Defined in:
- lib/uinit/structure/attribute.rb
Overview
rubocop:disable Metrics/ClassLength
Constant Summary collapse
- NAME_REGEX =
/\A[A-Za-z]\w*\z/
- UNDEFINED =
Class.new.new.freeze
Instance Attribute Summary collapse
-
#aliases ⇒ Object
Returns the value of attribute aliases.
-
#array_struct ⇒ Object
Returns the value of attribute array_struct.
-
#as_json ⇒ Object
Returns the value of attribute as_json.
-
#default ⇒ Object
Returns the value of attribute default.
-
#get ⇒ Object
Returns the value of attribute get.
-
#init ⇒ Object
Returns the value of attribute init.
-
#name ⇒ Object
Returns the value of attribute name.
-
#optional ⇒ Object
writeonly
Sets the attribute optional.
-
#private_get ⇒ Object
Returns the value of attribute private_get.
-
#private_set ⇒ Object
Returns the value of attribute private_set.
-
#set ⇒ Object
Returns the value of attribute set.
-
#struct ⇒ Object
Returns the value of attribute struct.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #as_json? ⇒ Boolean
-
#initialize ⇒ Attribute
constructor
A new instance of Attribute.
- #optional? ⇒ Boolean
Constructor Details
#initialize ⇒ Attribute
Returns a new instance of Attribute.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/uinit/structure/attribute.rb', line 10 def initialize @private_get = false @private_set = false @name = nil @type = nil @default = UNDEFINED @struct = nil @array_struct = false @init = true @get = nil @set = nil @as_json = true @aliases = [] end |
Instance Attribute Details
#aliases ⇒ Object
Returns the value of attribute aliases.
26 27 28 |
# File 'lib/uinit/structure/attribute.rb', line 26 def aliases @aliases end |
#array_struct ⇒ Object
Returns the value of attribute array_struct.
26 27 28 |
# File 'lib/uinit/structure/attribute.rb', line 26 def array_struct @array_struct end |
#as_json ⇒ Object
Returns the value of attribute as_json.
26 27 28 |
# File 'lib/uinit/structure/attribute.rb', line 26 def as_json @as_json end |
#default ⇒ Object
Returns the value of attribute default.
25 26 27 |
# File 'lib/uinit/structure/attribute.rb', line 25 def default @default end |
#get ⇒ Object
Returns the value of attribute get.
26 27 28 |
# File 'lib/uinit/structure/attribute.rb', line 26 def get @get end |
#init ⇒ Object
Returns the value of attribute init.
26 27 28 |
# File 'lib/uinit/structure/attribute.rb', line 26 def init @init end |
#name ⇒ Object
Returns the value of attribute name.
26 27 28 |
# File 'lib/uinit/structure/attribute.rb', line 26 def name @name end |
#optional=(value) ⇒ Object (writeonly)
Sets the attribute optional
97 98 99 |
# File 'lib/uinit/structure/attribute.rb', line 97 def optional=(value) @optional = value end |
#private_get ⇒ Object
Returns the value of attribute private_get.
26 27 28 |
# File 'lib/uinit/structure/attribute.rb', line 26 def private_get @private_get end |
#private_set ⇒ Object
Returns the value of attribute private_set.
26 27 28 |
# File 'lib/uinit/structure/attribute.rb', line 26 def private_set @private_set end |
#set ⇒ Object
Returns the value of attribute set.
26 27 28 |
# File 'lib/uinit/structure/attribute.rb', line 26 def set @set end |
#struct ⇒ Object
Returns the value of attribute struct.
26 27 28 |
# File 'lib/uinit/structure/attribute.rb', line 26 def struct @struct end |
#type ⇒ Object
Returns the value of attribute type.
26 27 28 |
# File 'lib/uinit/structure/attribute.rb', line 26 def type @type end |
Instance Method Details
#as_json? ⇒ Boolean
140 141 142 |
# File 'lib/uinit/structure/attribute.rb', line 140 def as_json? @as_json != false end |
#optional? ⇒ Boolean
93 94 95 |
# File 'lib/uinit/structure/attribute.rb', line 93 def optional? defined?(@optional) ? @optional : @default != UNDEFINED end |