Module: Cassie::Statements::Statement::Limiting
- Extended by:
- ActiveSupport::Concern
- Included in:
- Selection
- Defined in:
- lib/cassie/statements/statement/limiting.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/cassie/statements/statement/limiting.rb', line 15 def self.included(base) base.instance_eval do attr_writer :limit end base.extend ClassMethods end |
Instance Method Details
#limit ⇒ Object
42 43 44 45 |
# File 'lib/cassie/statements/statement/limiting.rb', line 42 def limit return @limit if defined?(@limit) self.class.limit end |
#with_limit(temp_limit) ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'lib/cassie/statements/statement/limiting.rb', line 47 def with_limit(temp_limit) raise ArgumentError, "block required for passing temporary limit" unless block_given? define_limit_singleton(temp_limit) yield ensure remove_limit_singleton end |