class Sinatra::Rabbit::Feature
Attributes
Public Class Methods
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
Source
# File lib/sinatra/rabbit/features.rb, line 44 def constraint(name, value) @constraints[name] = value end
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