Class: Looks::Command::Images
- Inherits:
-
AccountManagement
- Object
- Base
- AccountManagement
- Looks::Command::Images
- Defined in:
- lib/looks/command/images.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #configure(opts) ⇒ Object
- #execute(args) ⇒ Object
-
#initialize(config) ⇒ Images
constructor
A new instance of Images.
Methods inherited from Base
Constructor Details
#initialize(config) ⇒ Images
Returns a new instance of Images.
8 9 10 11 12 |
# File 'lib/looks/command/images.rb', line 8 def initialize(config) super @verbose = false end |
Instance Method Details
#configure(opts) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/looks/command/images.rb', line 14 def configure(opts) super opts.separator "" opts.separator "Options:" opts.on('-v', '--verbose', "Be verbose") do |address| @verbose = true end end |
#execute(args) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/looks/command/images.rb', line 25 def execute(args) super account = Gravatar::Account.new(config) images = account.images if @verbose addresses = account.addresses images.each do |image| puts "#{image.id}" addresses.select { |a| a.image == image }.each do |address| puts " #{address}" end end else puts images end end |