Skip to content

Instantly share code, notes, and snippets.

@zpieslak
Created July 23, 2015 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zpieslak/1292e720354b4524c330 to your computer and use it in GitHub Desktop.
Save zpieslak/1292e720354b4524c330 to your computer and use it in GitHub Desktop.
DataStructure
class DataStructure
def initialize
@data = {}
@default = nil
end
def set(index, value)
@data[index] = value
end
def get(index)
value = @data[index]
value ? value : @default
end
def set_all(value)
@data = {}
@default = value
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment