lib/cfoundry/v2/model.rb in cfoundry-0.3.41 vs lib/cfoundry/v2/model.rb in cfoundry-0.3.42

- old
+ new

@@ -1,10 +1,12 @@ require "multi_json" module CFoundry::V2 class Model class << self + attr_reader :scoped_organization, :scoped_space + def value_matches?(val, type) case type when Class val.is_a?(type) when Regexp @@ -57,9 +59,17 @@ @manifest ||= {} @manifest[:entity] ||= {} @manifest[:entity][name] = val @diff[name] = val } + end + + def scoped_to_organization(relation = :organization) + @scoped_organization = relation + end + + def scoped_to_space(relation = :space) + @scoped_space = relation end def to_one(name, opts = {}) obj = opts[:as] || name kls = obj.to_s.capitalize.gsub(/(.)_(.)/) do