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.



70
71
72
# File 'lib/anchor/types.rb', line 70

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



69
70
71
# File 'lib/anchor/types.rb', line 69

def description
  @description
end

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



69
70
71
# File 'lib/anchor/types.rb', line 69

def name
  @name
end

#optionalObject (readonly)

Returns the value of attribute optional

Returns:

  • (Object)

    the current value of optional



69
70
71
# File 'lib/anchor/types.rb', line 69

def optional
  @optional
end

#typeObject (readonly)

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



69
70
71
# File 'lib/anchor/types.rb', line 69

def type
  @type
end

Instance Method Details

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



74
75
76
77
78
79
80
81
# File 'lib/anchor/types.rb', line 74

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