Class: Vault::Properties::Property

Inherits:
Object
  • Object
show all
Defined in:
lib/vault/properties.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, primary = false, &default) ⇒ Property

Returns a new instance of Property.



44
45
46
47
48
# File 'lib/vault/properties.rb', line 44

def initialize(name, primary=false, &default)
  @name = name.to_s
  @default = default || lambda {}
  @primary = primary
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



42
43
44
# File 'lib/vault/properties.rb', line 42

def name
  @name
end

Instance Method Details

#defaultObject



54
55
56
# File 'lib/vault/properties.rb', line 54

def default
  @default.call
end

#eql?(other) ⇒ Boolean

:nodoc:

Returns:

  • (Boolean)


63
64
65
# File 'lib/vault/properties.rb', line 63

def eql?(other) # :nodoc:
  name == other.name
end

#hashObject

Set requires both #hash and #eql? to check for inclusion



59
60
61
# File 'lib/vault/properties.rb', line 59

def hash # :nodoc:
  name.hash
end

#primary?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/vault/properties.rb', line 50

def primary?
  @primary
end