Class: SafeYAML::Deep

### Home Classes Methods

### In Files

- lib/safe_yaml/deep.rb

### Parent

Object

### Methods

- ::copy
- ::freeze

### Class/Module Index

Quicksearch

- SafeYAML
- SafeYAML::Deep
- SafeYAML::LibyamlChecker
- SafeYAML::Parse
- SafeYAML::Parse::Date
- SafeYAML::Parse::Hexadecimal
- SafeYAML::Parse::Sexagesimal
- SafeYAML::PsychHandler
- SafeYAML::PsychResolver
- SafeYAML::Resolver
- SafeYAML::SafeToRubyVisitor
- SafeYAML::SyckResolver
- SafeYAML::Transform
- SafeYAML::Transform::ToBoolean
- SafeYAML::Transform::ToDate
- SafeYAML::Transform::ToFloat
- SafeYAML::Transform::ToInteger
- SafeYAML::Transform::ToNil
- SafeYAML::Transform::ToSymbol
- SafeYAML::Transform::TransformationMap
- SafeYAML::Transform::TransformationMap::CaseAgnosticMap
- SafeYAML::Transform::TransformationMap::ClassMethods
- Object
- YAML

No matching classes.

# SafeYAML::Deep

### Public Class Methods

copy(object) click to toggle source

    # File lib/safe_yaml/deep.rb, line 17
    def self.copy(object)
      duplicate = object.dup rescue object

      case object
      when Array
        (0...duplicate.count).each do |i|
          duplicate[i] = Deep.copy(duplicate[i])
        end
      when Hash
        duplicate.keys.each do |key|
          duplicate[key] = Deep.copy(duplicate[key])
        end
      end

      duplicate
    end

freeze(object) click to toggle source

    # File lib/safe_yaml/deep.rb, line 3
    def self.freeze(object)
      object.each do |*entry|
        value = entry.last
        case value
        when String, Regexp
          value.freeze
        when Enumerable
          Deep.freeze(value)
        end
      end

      return object.freeze
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.