Class: Anchor::Types::Property

Inherits:
Data
  • Object
show all
Defined in:
lib/anchor/types.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, type:, optional: false, description: nil) ⇒ Property

Returns a new instance of Property.



115
116
117
# File 'lib/anchor/types.rb', line 115

def initialize(name:, type:, optional: false, description: nil)
  super
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



114
115
116
# File 'lib/anchor/types.rb', line 114

def description
  @description
end

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



114
115
116
# File 'lib/anchor/types.rb', line 114

def name
  @name
end

#optionalObject (readonly)

Returns the value of attribute optional

Returns:

  • (Object)

    the current value of optional



114
115
116
# File 'lib/anchor/types.rb', line 114

def optional
  @optional
end

#typeObject (readonly)

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



114
115
116
# File 'lib/anchor/types.rb', line 114

def type
  @type
end

Instance Method Details

#dup(name: nil, type: nil, optional: nil, description: nil) ⇒ Object



119
120
121
122
123
124
125
126
# File 'lib/anchor/types.rb', line 119

def dup(name: nil, type: nil, optional: nil, description: nil)
  self.class.new(
    name: name || self.name,
    type: type || self.type,
    optional: optional.nil? ? self.optional : optional,
    description: description || self.description,
  )
end