Module: Struct::ToHash

Includes:
Ruby187, RubyOld
Included in:
Struct
Defined in:
lib/win32_service_manager/core_ext/struct_to_hash.rb

Defined Under Namespace

Modules: Ruby187, RubyOld

Instance Method Summary collapse

Methods included from RubyOld

#to_hash

Methods included from Ruby187

#to_hash

Instance Method Details

#hashable!Object

Raises:

  • (ArgumentError)


29
30
31
# File 'lib/win32_service_manager/core_ext/struct_to_hash.rb', line 29

def hashable!
  raise ArgumentError, "#{self.inspect} has duplicate keys" unless hashable?
end

#hashable?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/win32_service_manager/core_ext/struct_to_hash.rb', line 25

def hashable?
  self.class.members.uniq == self.class.members
end