Class: Shh::Command::ListKeys
- Inherits:
-
Object
- Object
- Shh::Command::ListKeys
- Defined in:
- lib/shh/command/list_keys.rb
Instance Attribute Summary collapse
-
#help ⇒ Object
readonly
Returns the value of attribute help.
-
#usage ⇒ Object
readonly
Returns the value of attribute usage.
Instance Method Summary collapse
- #execute(text = nil) ⇒ Object
-
#initialize(entry, io) ⇒ ListKeys
constructor
A new instance of ListKeys.
Constructor Details
#initialize(entry, io) ⇒ ListKeys
Returns a new instance of ListKeys.
4 5 6 7 8 |
# File 'lib/shh/command/list_keys.rb', line 4 def initialize entry, io @entry, @io = entry, io @usage = "(<substring>)" @help = "Lists all keys for the entry or those including the specified substring" end |
Instance Attribute Details
#help ⇒ Object (readonly)
Returns the value of attribute help.
2 3 4 |
# File 'lib/shh/command/list_keys.rb', line 2 def help @help end |
#usage ⇒ Object (readonly)
Returns the value of attribute usage.
2 3 4 |
# File 'lib/shh/command/list_keys.rb', line 2 def usage @usage end |
Instance Method Details
#execute(text = nil) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/shh/command/list_keys.rb', line 10 def execute text=nil @entry.each_key do |key| next if text and !(key =~ /#{text}/) @io.say key end end |