Class: PathRules::DateInfix
- Inherits:
-
Object
- Object
- PathRules::DateInfix
- Defined in:
- lib/path_rules.rb
Overview
日付によるprefix, suffix, infixなどを表現するためのクラス
Constant Summary collapse
- OUTPUT_FORMAT =
各種メソッドで日付を表現する時のフォーマット
'%Y-%m-%d'
Instance Method Summary collapse
-
#beginning_of_month ⇒ String
Initializeに使った日付の月初日。.
-
#initialize(date) ⇒ DateInfix
constructor
A new instance of DateInfix.
- #to_s ⇒ Object
Constructor Details
#initialize(date) ⇒ DateInfix
Returns a new instance of DateInfix.
31 32 33 34 35 |
# File 'lib/path_rules.rb', line 31 def initialize(date) check_argument_format!(date) @date = Date.strptime(date, '%Y-%m-%d') end |
Instance Method Details
#beginning_of_month ⇒ String
Returns initializeに使った日付の月初日。.
42 43 44 |
# File 'lib/path_rules.rb', line 42 def beginning_of_month @date.beginning_of_month.strftime(OUTPUT_FORMAT) end |
#to_s ⇒ Object
37 38 39 |
# File 'lib/path_rules.rb', line 37 def to_s @date.strftime(OUTPUT_FORMAT) end |