Class: Microscope::Scope::DatetimeScope
- Inherits:
-
Microscope::Scope
- Object
- Struct
- Microscope::Scope
- Microscope::Scope::DatetimeScope
- Defined in:
- lib/microscope/scope/datetime_scope.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Microscope::Scope
Instance Method Summary collapse
- #apply ⇒ Object
-
#initialize(*args) ⇒ DatetimeScope
constructor
A new instance of DatetimeScope.
Methods inherited from Microscope::Scope
#cropped_field, inject_scopes, #quoted_field
Constructor Details
#initialize(*args) ⇒ DatetimeScope
Returns a new instance of DatetimeScope.
4 5 6 7 8 9 10 11 12 |
# File 'lib/microscope/scope/datetime_scope.rb', line 4 def initialize(*args) super @now = 'Time.now' @now_suffix = '_now' @specific_suffix = '_at' @cropped_field_regex = /_at$/ @formatted_time = 'time' end |
Instance Method Details
#apply ⇒ Object
14 15 16 |
# File 'lib/microscope/scope/datetime_scope.rb', line 14 def apply model.class_eval(apply_scopes) if @field_name =~ @cropped_field_regex end |