Class: ForemanInventoryUpload::Generators::Metadata
- Inherits:
-
Object
- Object
- ForemanInventoryUpload::Generators::Metadata
- Includes:
- FactHelpers
- Defined in:
- lib/foreman_inventory_upload/generators/metadata.rb
Constant Summary
Constants included from FactHelpers
FactHelpers::CLOUD_ALIBABA, FactHelpers::CLOUD_AMAZON, FactHelpers::CLOUD_AZURE, FactHelpers::CLOUD_GOOGLE, FactHelpers::UUID_REGEX
Instance Method Summary collapse
- #add_slice(slice_id, hosts_count, first) ⇒ Object
-
#initialize(output = []) ⇒ Metadata
constructor
A new instance of Metadata.
- #render(metadata = nil, &block) ⇒ Object
Methods included from FactHelpers
#account_id, #bios_uuid, #cloud_provider, #fact_value, #fqdn, #golden_ticket?, #host_ips, #hostname_match, #kilobytes_to_bytes, #obfuscate_fqdn, #obfuscate_hostname?, #obfuscate_ip, #obfuscate_ips?, #obfuscated_ips, #uuid_value, #uuid_value!
Constructor Details
#initialize(output = []) ⇒ Metadata
Returns a new instance of Metadata.
5 6 7 |
# File 'lib/foreman_inventory_upload/generators/metadata.rb', line 5 def initialize(output = []) @stream = JsonStream.new(output) end |
Instance Method Details
#add_slice(slice_id, hosts_count, first) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/foreman_inventory_upload/generators/metadata.rb', line 9 def add_slice(slice_id, hosts_count, first) @stream.comma unless first @stream.object_field(slice_id, :last) do @stream.simple_field('number_hosts', hosts_count, :last) end end |
#render(metadata = nil, &block) ⇒ Object
17 18 19 20 |
# File 'lib/foreman_inventory_upload/generators/metadata.rb', line 17 def render( = nil, &block) render_report(, &block) @stream.out end |