Skip to content

Instantly share code, notes, and snippets.

@reinh
Created January 23, 2009 21:57
Show Gist options
  • Save reinh/51220 to your computer and use it in GitHub Desktop.
Save reinh/51220 to your computer and use it in GitHub Desktop.
class Endeca::Document < SomeAwesomeName::Abstract
def properties
@properties ||= @raw['Properties'] || {}
end
alias_method :attributes, :properties
# Returns the collection of Endeca::Dimension for the given Document
def dimensions
return @dimensions if @dimensions
@dimensions = {}
(raw['Dimensions'] || {}).each do |name, values|
values = [values] unless Array === values
@dimensions[name] = values.map(&Dimension)
end
@dimensions
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment