Created
March 25, 2016 18:27
-
-
Save rusilko/48899b4808eba9804d37 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DataWrapper | |
def initialize(data_hash) | |
raise ArgumentError unless data_hash.is_a? Hash | |
@data_hash = data_hash | |
end | |
def add(name, value) | |
DataWrapper.new(data_hash.merge({ name.to_sym => value })) | |
end | |
def to_hash | |
data_hash | |
end | |
private; attr_reader :data_hash | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment