diff options
author | Eric Wong <e@80x24.org> | 2015-01-25 10:51:50 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-01-25 10:59:51 +0000 |
commit | ead7725fa693c7dd832b22f77b32847c81a70d72 (patch) | |
tree | 44a662deec10ae6af49ea0b44ebf2d2f8793c562 /lib | |
parent | ef6dc55d9c40aaac9d1fbe5438dbaedc2ddad5e0 (diff) | |
download | dtas-ead7725fa693c7dd832b22f77b32847c81a70d72.tar.gz |
While the Ruby Hash class is ordered in 1.9+, the YAML specifications do not specify hashes as ordered by default. Thus we must explicitly declare ordering via !omap for interopability with non-Ruby tools. This makes the YAML output of dtas-sourcedit and dtas-sinkedit slightly more verbose Users of dtas-splitfx are also encouraged to declare !omap when creating their YAML files for interoperability. Ordering env is important because any implementation of built-in variable expansion is dependent on it.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dtas/player.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/dtas/player.rb b/lib/dtas/player.rb index d63bc8a..d6707c3 100644 --- a/lib/dtas/player.rb +++ b/lib/dtas/player.rb @@ -120,6 +120,10 @@ class DTAS::Player # :nodoc: rv end + def to_omap(hash) + YAML::Omap === hash ? hash : YAML::Omap.new.merge!(hash) + end + def self.load(hash) rv = new rv.instance_eval do @@ -150,6 +154,7 @@ class DTAS::Player # :nodoc: @source_map.each do |name, src| src_hsh = v[name] or next src.load!(src_hsh) + src.env = to_omap(src.env) end source_map_reload end @@ -161,6 +166,7 @@ class DTAS::Player # :nodoc: if sinks = hash["sinks"] sinks.each do |sink_hsh| sink = DTAS::Sink.load(sink_hsh) + sink.env = to_omap(sink.env) @sinks[sink.name] = sink end end |