Sha256: 4562b8a477545afa0ee6c7bfee20462f4d5f387744bcde7d481fb64b51547231

Contents?: true

Size: 551 Bytes

Versions: 10

Compression:

Stored size: 551 Bytes

Contents

require 'hammer_cli'

module Fields

  class SingleReference < Field

    def display?(value)
      id_key = "#{parameters[:key]}_id"
      display_field = parameters[:display_field] || 'name'
      display_key = "#{parameters[:key]}_#{display_field}"

      (value[display_key.to_sym] || value[display_key]) && (value[id_key.to_sym] || value[id_key])
    end
  end

  class Reference < Field
  end

  class Template < Reference

    def initialize(options={})
      options[:details] ||= [:template_kind_name]
      super(options)
    end
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
hammer_cli_foreman-0.14.0 lib/hammer_cli_foreman/output/fields.rb
hammer_cli_foreman-0.13.2 lib/hammer_cli_foreman/output/fields.rb
hammer_cli_foreman-0.13.1 lib/hammer_cli_foreman/output/fields.rb
hammer_cli_foreman-0.13.0 lib/hammer_cli_foreman/output/fields.rb
hammer_cli_foreman-0.12.1 lib/hammer_cli_foreman/output/fields.rb
hammer_cli_foreman-0.12.0 lib/hammer_cli_foreman/output/fields.rb
hammer_cli_foreman-0.11.0 lib/hammer_cli_foreman/output/fields.rb
hammer_cli_foreman-0.10.2 lib/hammer_cli_foreman/output/fields.rb
hammer_cli_foreman-0.10.1 lib/hammer_cli_foreman/output/fields.rb
hammer_cli_foreman-0.10.0 lib/hammer_cli_foreman/output/fields.rb