Class: EasyCreds::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/easy_creds/init_state.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key:, placeholder:, hint:, op_value: nil) ⇒ Entry

Returns a new instance of Entry.



7
8
9
10
11
12
13
14
# File 'lib/easy_creds/init_state.rb', line 7

def initialize(key:, placeholder:, hint:, op_value: nil)
  @key         = key
  @placeholder = placeholder
  @hint        = hint
  @op_value    = op_value
  @value       = nil
  @source      = :unset
end

Instance Attribute Details

#hintObject

Returns the value of attribute hint.



5
6
7
# File 'lib/easy_creds/init_state.rb', line 5

def hint
  @hint
end

#keyObject

Returns the value of attribute key.



5
6
7
# File 'lib/easy_creds/init_state.rb', line 5

def key
  @key
end

#op_valueObject (readonly)

Returns the value of attribute op_value.



17
18
19
# File 'lib/easy_creds/init_state.rb', line 17

def op_value
  @op_value
end

#placeholderObject

Returns the value of attribute placeholder.



5
6
7
# File 'lib/easy_creds/init_state.rb', line 5

def placeholder
  @placeholder
end

#sourceObject

Returns the value of attribute source.



5
6
7
# File 'lib/easy_creds/init_state.rb', line 5

def source
  @source
end

#valueObject

Returns the value of attribute value.



5
6
7
# File 'lib/easy_creds/init_state.rb', line 5

def value
  @value
end

Instance Method Details

#masked_valueObject



19
20
21
22
23
24
# File 'lib/easy_creds/init_state.rb', line 19

def masked_value
  return nil unless value

  len = value.to_s.length
  "#{'' * [len, 8].min} (#{len} chars)"
end

#set?Boolean

Returns:

  • (Boolean)


16
# File 'lib/easy_creds/init_state.rb', line 16

def set? = source != :unset