Sha256: 8bb6d5094ea334647b3b67df4f6b2ecce0d22e554dee6b23b6f65cedcf92dd90
Contents?: true
Size: 1.52 KB
Versions: 1
Compression:
Stored size: 1.52 KB
Contents
# frozen_string_literal: true require_relative './gateway/single' require_relative './gateway/range' require_relative './condition' require_relative './output/error' # :nodoc: module Zakuro # # Merchant ざくろ商人 # 東西の暦を取引する、素敵な笑顔の持ち主 # class Merchant # @return [Hash<Symbol, Object>] 条件 attr_reader :condition # # 初期化 # # @param [Hash<Symbol, Object>] condition 条件 # def initialize(condition: {}) failed = Condition.validate(hash: condition) raise Output::ZakuroError, failed.join('\n') unless failed.empty? @condition = Condition.new(hash: condition) end # # 条件提示する # # @param [Hash<Symbol, Object>] condition 条件 # # @return [Merchant] 自インスタンス # def offer(condition: {}) failed = Condition.validate(hash: condition) raise Output::ZakuroError, failed.join('\n') unless failed.empty? @condition.rewrite(hash: condition) self end # # 承諾する # # @return [Result::SingleDay] 和暦日 # @return [Result::Range] 和暦日範囲 # def commit # TODO: condition で設定する context = Context.new(version_name: '') single = Gateway::Single.new(context: context, date: condition.date) return single.get unless single.invalid? range = Gateway::Range.new(context: context, range: condition.range) return range.get unless range.invalid? {} end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
zakuro-0.7.0 | lib/zakuro/merchant.rb |