module Crows
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Constants
- SUFFIX
- VERSION
Public Instance Methods
crow(record)
click to toggle source
# File lib/crows.rb, line 34 def crow(record) instance = find_crowclass(record).new(crow_user, record) crows[record] = instance unless record.is_a? Class instance end
crow_scope(klass)
click to toggle source
# File lib/crows.rb, line 40 def crow_scope(klass) crows_scope[klass] = crow(klass) crows_scope[klass].resolve end
crow_user()
click to toggle source
# File lib/crows.rb, line 53 def crow_user current_user end
crows()
click to toggle source
# File lib/crows.rb, line 57 def crows @crows ||= {} end
crows_scope()
click to toggle source
# File lib/crows.rb, line 61 def crows_scope @crows_scope ||= {} end
Private Instance Methods
find_crowclass(record)
click to toggle source
# File lib/crows.rb, line 67 def find_crowclass(record) klass = if record.is_a? Class Object.const_get(record.to_s + SUFFIX)::Scope else Object.const_get(record.class.to_s + SUFFIX) end rescue NameError raise NotDefinedError, "unable to find crow #{klass} for #{record.inspect}" end