Class: HashPoser
- Inherits:
-
Proc
- Object
- Proc
- HashPoser
- Includes:
- Enumerable
- Defined in:
- lib/rails_ext/active_record/merge_default_scope/hash_poser.rb
Overview
Hack to use dynamic default_scope
Instance Attribute Summary collapse
-
#proc ⇒ Object
Returns the value of attribute proc.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #each(*a, &b) ⇒ Object
- #fetch(key) ⇒ Object
-
#initialize(&b) ⇒ HashPoser
constructor
A new instance of HashPoser.
- #keys ⇒ Object
- #merge(*a, &b) ⇒ Object
- #to_hash ⇒ Object
- #to_s ⇒ Object (also: #inspect)
Constructor Details
#initialize(&b) ⇒ HashPoser
Returns a new instance of HashPoser.
7 8 9 10 |
# File 'lib/rails_ext/active_record/merge_default_scope/hash_poser.rb', line 7 def initialize &b @proc = b super &b end |
Instance Attribute Details
#proc ⇒ Object
Returns the value of attribute proc.
5 6 7 |
# File 'lib/rails_ext/active_record/merge_default_scope/hash_poser.rb', line 5 def proc @proc end |
Instance Method Details
#[](key) ⇒ Object
12 13 14 |
# File 'lib/rails_ext/active_record/merge_default_scope/hash_poser.rb', line 12 def [](key) call[key] end |
#each(*a, &b) ⇒ Object
16 17 18 |
# File 'lib/rails_ext/active_record/merge_default_scope/hash_poser.rb', line 16 def each(*a, &b) call.each(*a, &b) end |
#fetch(key) ⇒ Object
20 21 22 |
# File 'lib/rails_ext/active_record/merge_default_scope/hash_poser.rb', line 20 def fetch(key) call.fetch(key) end |
#keys ⇒ Object
24 25 26 |
# File 'lib/rails_ext/active_record/merge_default_scope/hash_poser.rb', line 24 def keys call.keys end |
#merge(*a, &b) ⇒ Object
28 29 30 |
# File 'lib/rails_ext/active_record/merge_default_scope/hash_poser.rb', line 28 def merge(*a, &b) call.merge(*a, &b) end |
#to_hash ⇒ Object
32 33 34 |
# File 'lib/rails_ext/active_record/merge_default_scope/hash_poser.rb', line 32 def to_hash call end |
#to_s ⇒ Object Also known as: inspect
36 37 38 |
# File 'lib/rails_ext/active_record/merge_default_scope/hash_poser.rb', line 36 def to_s "#<HashPoser: #{call.inspect}>" end |