class Sinatra::Rabbit::Feature
Attributes
collection[R]
constraints[R]
description[R]
name[R]
operations[R]
Public Class Methods
new(name, opts={}, &block)
click to toggle source
# File lib/sinatra/rabbit/features.rb, line 26 def initialize(name, opts={}, &block) @name = name @operations = [] @collection = opts[:for] @constraints = {} raise "Each feature must define collection for which it will be valid using :for parameter" unless @collection instance_eval(&block) if block_given? end
Public Instance Methods
constraint(name, value)
click to toggle source
# File lib/sinatra/rabbit/features.rb, line 44 def constraint(name, value) @constraints[name] = value end
operation(name, &block)
click to toggle source
# File lib/sinatra/rabbit/features.rb, line 35 def operation(name, &block) @operations << Operation.new(name, &block) if block_given? @operations.find { |o| o.name == name } end