module Mongosteen::ClassMethods

Public Instance Methods

csv_config(config_hash={}) click to toggle source
# File lib/mongosteen/class_methods.rb, line 11
def csv_config(config_hash={})
  self.as_csv_config = config_hash
end
json_config(config_hash={}) click to toggle source
# File lib/mongosteen/class_methods.rb, line 3
def json_config(config_hash={})
  self.as_json_config_actions = {}
  actions = config_hash.delete(:actions) || {}

  set_json_actions(actions)
  set_json_default(config_hash)
end

Private Instance Methods

set_json_actions(config) click to toggle source
# File lib/mongosteen/class_methods.rb, line 17
def set_json_actions(config)
  config.each do |k, v|
    v[:methods] ||= []
    v[:methods].concat(json_default_methods).uniq!
  end
  self.as_json_config_actions = config
end
set_json_default(config) click to toggle source
# File lib/mongosteen/class_methods.rb, line 25
def set_json_default(config)
  config[:methods] ||= []
  config[:methods].concat(json_default_methods).uniq!
  self.as_json_config = config
end