File: indirector_testing.rb

package info (click to toggle)
puppet-agent 8.10.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 27,404 kB
  • sloc: ruby: 286,820; sh: 492; xml: 116; makefile: 88; cs: 68
file content (31 lines) | stat: -rw-r--r-- 559 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
require 'puppet/indirector'

class Puppet::IndirectorTesting
  extend Puppet::Indirector
  indirects :indirector_testing

  # We should have some way to identify if we got a valid object back with the
  # current values, no?
  attr_accessor :value
  alias_method :name, :value
  alias_method :name=, :value=
  def initialize(value)
    self.value = value
  end

  def self.from_binary(raw)
    new(raw)
  end

  def self.from_data_hash(data)
    new(data['value'])
  end

  def to_binary
    value
  end

  def to_data_hash
    { 'value' => value }
  end
end