Class: CheckIn::Writer::Configuration
- Inherits:
-
Object
- Object
- CheckIn::Writer::Configuration
- Defined in:
- lib/check_in/writer.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
Instance Method Summary collapse
-
#check_in_after(method_name) ⇒ Object
redefine method to call check_in after original method is called.
-
#check_in_before(method_name) ⇒ Object
redefine method to call check_in before original method is called.
-
#initialize(base) ⇒ Configuration
constructor
A new instance of Configuration.
- #instance_name_method ⇒ Object
- #instance_name_method=(instance_name_method) ⇒ Object
- #list_length ⇒ Object
- #list_length=(list_length) ⇒ Object
- #redis_key ⇒ Object
- #service_name ⇒ Object
- #service_name=(service_name) ⇒ Object
- #setup {|_self| ... } ⇒ Object
Constructor Details
#initialize(base) ⇒ Configuration
Returns a new instance of Configuration.
17 18 19 |
# File 'lib/check_in/writer.rb', line 17 def initialize(base) @base = base end |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
15 16 17 |
# File 'lib/check_in/writer.rb', line 15 def base @base end |
Instance Method Details
#check_in_after(method_name) ⇒ Object
redefine method to call check_in after original method is called
46 47 48 49 50 51 52 53 54 |
# File 'lib/check_in/writer.rb', line 46 def check_in_after(method_name) base.class_eval <<-END alias_method :pre_check_in_#{method_name}, :#{method_name} def #{method_name}(*args) pre_check_in_#{method_name}(*args) check_in(*args) end END end |
#check_in_before(method_name) ⇒ Object
redefine method to call check_in before original method is called
57 58 59 60 61 62 63 64 65 |
# File 'lib/check_in/writer.rb', line 57 def check_in_before(method_name) base.class_eval <<-END alias_method :pre_check_in_#{method_name}, :#{method_name} def #{method_name}(*args) check_in(*args) pre_check_in_#{method_name}(*args) end END end |
#instance_name_method ⇒ Object
41 42 43 |
# File 'lib/check_in/writer.rb', line 41 def instance_name_method @instance_name_method ||= :to_s end |
#instance_name_method=(instance_name_method) ⇒ Object
37 38 39 |
# File 'lib/check_in/writer.rb', line 37 def instance_name_method=(instance_name_method) @instance_name_method = instance_name_method end |
#list_length ⇒ Object
33 34 35 |
# File 'lib/check_in/writer.rb', line 33 def list_length @list_length || 500 end |
#list_length=(list_length) ⇒ Object
29 30 31 |
# File 'lib/check_in/writer.rb', line 29 def list_length=(list_length) @list_length = list_length end |
#redis_key ⇒ Object
67 68 69 |
# File 'lib/check_in/writer.rb', line 67 def redis_key "checkins:#{service_name}" end |
#service_name ⇒ Object
25 26 27 |
# File 'lib/check_in/writer.rb', line 25 def service_name @service_name ||= base.name end |
#service_name=(service_name) ⇒ Object
21 22 23 |
# File 'lib/check_in/writer.rb', line 21 def service_name=(service_name) @service_name = service_name end |
#setup {|_self| ... } ⇒ Object
71 72 73 |
# File 'lib/check_in/writer.rb', line 71 def setup(&block) yield self end |