Class: Google::Storage::Property::Boolean

Inherits:
Base
  • Object
show all
Defined in:
lib/google/storage/property/boolean.rb

Overview

A Puppet property that holds a string

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.api_munge(value) ⇒ Object



44
45
46
47
# File 'lib/google/storage/property/boolean.rb', line 44

def self.api_munge(value)
  return if value.nil?
  value
end

.unsafe_munge(value) ⇒ Object



35
36
37
38
# File 'lib/google/storage/property/boolean.rb', line 35

def self.unsafe_munge(value)
  return if value.nil?
  value
end

Instance Method Details

#insync?(is) ⇒ Boolean

Returns:



49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/google/storage/property/boolean.rb', line 49

def insync?(is)
  test_is = Puppet::Coercion.boolean(is)
  test_should = Puppet::Coercion.boolean(should)
  debug("insync? #{name}: '#{test_is}' == '#{test_should}'")
  insync = false
  insync = true if test_is == :absent && test_should == :absent
  insync = (test_is == test_should) \
    unless test_is == :absent || test_should == :absent
  debug("insync? #{name}: '#{test_is}' == '#{test_should}': #{insync}")
  resource.provider.dirty name, is, should unless insync
  insync
end

#unsafe_munge(value) ⇒ Object



40
41
42
# File 'lib/google/storage/property/boolean.rb', line 40

def unsafe_munge(value)
  self.class.unsafe_munge(value)
end