Class: Stronger::Property

Inherits:
Object
  • Object
show all
Defined in:
lib/stronger/property.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type:, required: true) ⇒ Property

Returns a new instance of Property.



4
5
6
# File 'lib/stronger/property.rb', line 4

def initialize(name, type:, required: true)
  @name, @type, @required = name, type, required
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/stronger/property.rb', line 3

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/stronger/property.rb', line 3

def type
  @type
end

Instance Method Details

#required?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/stronger/property.rb', line 8

def required?
  !!required
end

#typed?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/stronger/property.rb', line 12

def typed?
  !type.nil?
end