Module: Occi::Cli::Helpers::DiscoverHelper
- Defined in:
- lib/occi/cli/helpers/discover_helper.rb
Instance Method Summary collapse
- #helper_discover(options, output = nil) ⇒ Object
- #helper_discover_output(found, options, output) ⇒ Object
Instance Method Details
#helper_discover(options, output = nil) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/occi/cli/helpers/discover_helper.rb', line 3 def helper_discover(, output = nil) found = Occi::Core::Kinds.new case .entity_type when :resource # get everything related to Occi::Core::Resource resource_type_identifiers.each { |resource_ti| found << model.get_by_id(resource_ti) } when :link # get everything related to Occi::Core::Link link_type_identifiers.each { |link_ti| found << model.get_by_id(link_ti) } else Occi::Cli::Log.warn "Attempting to discover an " \ "unknown entity type #{options.entity_type.to_s.inspect}" raise "Unknown entity type #{options.entity_type.to_s.inspect}, " \ "terminating discovery!" end helper_discover_output(found, , output) end |
#helper_discover_output(found, options, output) ⇒ Object
23 24 25 26 27 |
# File 'lib/occi/cli/helpers/discover_helper.rb', line 23 def helper_discover_output(found, , output) return found unless output puts output.format(found) end |