Sha256: dcdacec1b6d0a3f1042f76bd619dcfe0ccef8fee3aea74d5a6d4fc0ae4935a11

Contents?: true

Size: 423 Bytes

Versions: 4

Compression:

Stored size: 423 Bytes

Contents

# frozen_string_literal: true

class Core::Repositories::<%= @scope_class %>::<%= @repository_class %> < Core::Repositories::AbstractRepository
  def initialize(id:)
    @id  = id
  end

  def call(builder: true)
    resource = <%= @model_class %>.find_by(id: @id)
    return Failure '<%= @subject_class %> not found' unless resource.present?
    Success Core::Builders::<%= @subject_class %>.new(resource).build
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rider-kick-0.0.5 lib/generators/rider_kick/templates/domains/core/repositories/fetch_by_id.rb.tt
rider-kick-0.0.4 lib/generators/rider_kick/templates/domains/core/repositories/fetch_by_id.rb.tt
rider-kick-0.0.3 lib/generators/rider_kick/templates/domains/core/repositories/fetch_by_id.rb.tt
rider-kick-0.0.2 lib/generators/rider_kick/templates/domains/core/repositories/fetch_by_id.rb.tt