aboutsummaryrefslogtreecommitdiffstats
path: root/spec/support/data_modifier/box.rb
blob: 0847b628ccf00bc43454bcaba5c6a1054703f4ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require_relative 'hash'
module Support
  module DataModifier
    module Box
      def next
        raise "Need to implement #{__method__} in #{self.class}"
      end

      class << self
        def unbox atts
          Hash.map_values(atts, method(:value_of))
        end
        def value_of v
          self === v ? v.value : v
        end
      end
    end

  end
end