class Ruhoh::Resources::Data::CollectionView

Public Class Methods

new(collection) click to toggle source
Calls superclass method
# File lib/ruhoh/resources/data/collection_view.rb, line 4
def initialize(collection)
  super(collection)

  # Define direct access to the dictionary Hash object
  # but don't overwrite methods if already defined.
  dictionary.keys.each do |method|
    (class << self; self; end).class_eval do
      next if method_defined?(method)
      define_method method do |*args, &block|
        dictionary[method]
      end
    end
  end
end

Public Instance Methods

[](attribute) click to toggle source
# File lib/ruhoh/resources/data/collection_view.rb, line 19
def [](attribute)
  __send__(attribute)
end