Class: NoSE::Serialize::SearchResultRepresenter

Inherits:
Representable::Decorator
  • Object
show all
Extended by:
Forwardable
Includes:
Representable::Hash, Representable::JSON, Representable::Uncached, Representable::YAML
Defined in:
lib/nose/serialize.rb

Overview

Represent results of a search operation

Instance Method Summary collapse

Methods included from Representable::Uncached

#representable_map

Instance Method Details

#commandString

The full command used to generate the results

Returns:

  • (String)


752
753
754
# File 'lib/nose/serialize.rb', line 752

def command
  "#{$PROGRAM_NAME} #{ARGV.join ' '}"
end

#cost_modelHash

The backend cost model used to generate the schema

Returns:

  • (Hash)


703
704
705
706
707
# File 'lib/nose/serialize.rb', line 703

def cost_model
  options = represented.cost_model.instance_variable_get(:@options)
  options[:name] = represented.cost_model.subtype_name
  options
end

#cost_model=(options) ⇒ void

This method returns an undefined value.

Look up the cost model by name and attach to the results



711
712
713
714
715
# File 'lib/nose/serialize.rb', line 711

def cost_model=(options)
  options = options.deep_symbolize_keys
  cost_model_class = Cost::Cost.subtype_class(options[:name])
  represented.cost_model = cost_model_class.new(**options)
end

#revisionString

Include the revision of the code used to generate this output

Returns:

  • (String)


730
731
732
# File 'lib/nose/serialize.rb', line 730

def revision
  `git rev-parse HEAD 2> /dev/null`.strip
end

#timeTime

The time the results were generated

Returns:



738
739
740
# File 'lib/nose/serialize.rb', line 738

def time
  Time.now.rfc2822
end

#time=(time) ⇒ void

This method returns an undefined value.

Reconstruct the time object from the timestamp



744
745
746
# File 'lib/nose/serialize.rb', line 744

def time=(time)
  represented.time = Time.rfc2822 time
end