Class: YAML::Store

Inherits:
PStore show all
Defined in:
lib/yaml/store.rb

Constant Summary collapse

EMPTY_MARSHAL_DATA =
{}.to_yaml
EMPTY_MARSHAL_CHECKSUM =
Digest::MD5.digest(EMPTY_MARSHAL_DATA)

Instance Method Summary collapse

Constructor Details

#initialize(*o) ⇒ Store

Returns a new instance of Store.



8
9
10
11
12
13
14
15
16
# File 'lib/yaml/store.rb', line 8

def initialize( *o )
  @opt = YAML::DEFAULTS.dup
  if String === o.first
    super(o.shift)
  end
  if o.last.is_a? Hash
    @opt.update(o.pop)
  end
end

Instance Method Details

#dump(table) ⇒ Object



18
19
20
# File 'lib/yaml/store.rb', line 18

def dump(table)
  @table.to_yaml(@opt)
end

#empty_marshal_checksumObject



40
41
42
# File 'lib/yaml/store.rb', line 40

def empty_marshal_checksum
  EMPTY_MARSHAL_CHECKSUM
end

#empty_marshal_dataObject



37
38
39
# File 'lib/yaml/store.rb', line 37

def empty_marshal_data
  EMPTY_MARSHAL_DATA
end

#load(content) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/yaml/store.rb', line 22

def load(content)
  table = YAML::load(content)
  if table == false
    {}
  else
    table
  end
end

#marshal_dump_supports_canonical_option?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/yaml/store.rb', line 31

def marshal_dump_supports_canonical_option?
  false
end