Class: Zakuro::Gateway::Single
- Inherits:
-
Object
- Object
- Zakuro::Gateway::Single
- Defined in:
- lib/zakuro/gateway/single.rb
Overview
Single 1日
Instance Attribute Summary collapse
-
#date ⇒ Locale::Date
readonly
日付.
Instance Method Summary collapse
-
#get ⇒ Result::Single
検索結果を取得する.
-
#initialize(context:, date:) ⇒ Single
constructor
初期化.
-
#invalid? ⇒ True, False
不正か.
Constructor Details
#initialize(context:, date:) ⇒ Single
初期化
27 28 29 30 |
# File 'lib/zakuro/gateway/single.rb', line 27 def initialize(context:, date:) @context = context @date = Locale::Date.new(date: date) end |
Instance Attribute Details
#date ⇒ Locale::Date (readonly)
Returns 日付.
19 20 21 |
# File 'lib/zakuro/gateway/single.rb', line 19 def date @date end |
Instance Method Details
#get ⇒ Result::Single
検索結果を取得する
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/zakuro/gateway/single.rb', line 47 def get if date.valid_western? return Calculation::Summary::Western::Single.get( context: @context, date: date.western_date ) end if date.valid_japan? return Calculation::Summary::Japan::Single.get( context: @context, date: date.japan_date ) end raise invalid_date_error end |
#invalid? ⇒ True, False
不正か
38 39 40 |
# File 'lib/zakuro/gateway/single.rb', line 38 def invalid? date.invalid? end |