Skip to content

Instantly share code, notes, and snippets.

@sigmonsays
Created September 15, 2009 22:37
Show Gist options
  • Save sigmonsays/187723 to your computer and use it in GitHub Desktop.
Save sigmonsays/187723 to your computer and use it in GitHub Desktop.
class Disk
class Collector
include Enumerable
def initialize(args)
@platform = args[:platform]
puts "#{self} platform #{@platform}"
# how do I include Disk::Collector::Linux ???
end
def each_disk
%w{ a b c }.each do |n|
disk = {}
disk[ :name ] = "name-#{n}"
disk[ :type ] = "type-#{n}"
yield disk
end
end
end
end
class Disk
class Collector
class Linux
def each_disk
end
end
end
end
Disk::Collector.new( :platform => :linux ).each_disk do |disk|
puts "#{disk[:name]} #{disk[:type]}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment