Class: EasyCreds::Entry
- Inherits:
-
Object
- Object
- EasyCreds::Entry
- Defined in:
- lib/easy_creds/init_state.rb
Instance Attribute Summary collapse
-
#hint ⇒ Object
Returns the value of attribute hint.
-
#key ⇒ Object
Returns the value of attribute key.
-
#op_value ⇒ Object
readonly
Returns the value of attribute op_value.
-
#placeholder ⇒ Object
Returns the value of attribute placeholder.
-
#source ⇒ Object
Returns the value of attribute source.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(key:, placeholder:, hint:, op_value: nil) ⇒ Entry
constructor
A new instance of Entry.
- #masked_value ⇒ Object
- #set? ⇒ Boolean
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
#hint ⇒ Object
Returns the value of attribute hint.
5 6 7 |
# File 'lib/easy_creds/init_state.rb', line 5 def hint @hint end |
#key ⇒ Object
Returns the value of attribute key.
5 6 7 |
# File 'lib/easy_creds/init_state.rb', line 5 def key @key end |
#op_value ⇒ Object (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 |
#placeholder ⇒ Object
Returns the value of attribute placeholder.
5 6 7 |
# File 'lib/easy_creds/init_state.rb', line 5 def placeholder @placeholder end |
#source ⇒ Object
Returns the value of attribute source.
5 6 7 |
# File 'lib/easy_creds/init_state.rb', line 5 def source @source end |
#value ⇒ Object
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_value ⇒ Object
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
16 |
# File 'lib/easy_creds/init_state.rb', line 16 def set? = source != :unset |