Skip to content

Commit

Permalink
refactor: EventBridgeSchedule.new の引数を名前付き引数にする
Browse files Browse the repository at this point in the history
  • Loading branch information
morikiyo committed May 2, 2024
1 parent 2a15df2 commit 70a338b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/sg_fargate_rails/event_bridge_schedule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ class EventBridgeSchedule

attr_reader :name

def initialize(name, cron, command, container_type, storage_size_gb, use_bundler: true)
def initialize(name:, cron:, command:, container_type: 'small', storage_size_gb: nil, use_bundler: true)
@name = name
@cron = cron
@command = command
@container_type = container_type || 'small'
@container_type = container_type
@storage_size_gb = storage_size_gb # sizeInGiB
@use_bundler = use_bundler
end
Expand Down Expand Up @@ -103,8 +103,8 @@ class << self
def convert(schedules)
schedules.to_h.map { |name, info|
EventBridgeSchedule.new(
name.to_s, info[:cron], info[:command], info[:container_type], info[:storage_size_gb],
use_bundler: info[:use_bundler].nil? ? true : info[:use_bundler]
name: name.to_s,
**info.slice(:cron, :command, :container_type, :storage_size_gb, :use_bundler)
)
}
end
Expand Down

0 comments on commit 70a338b

Please sign in to comment.