Skip to content

Commit

Permalink
wip: data class generator
Browse files Browse the repository at this point in the history
  • Loading branch information
yawboakye committed Jun 6, 2024
1 parent ce38085 commit 93c7964
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/generators/categoria/data_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ class DataGenerator < ::Rails::Generators::NamedBase
extend T::Sig

source_root File.expand_path("templates", __dir__)

desc <<~DOC.squish
generates a data class for the domain. data classes are used
like value classes: hashes are more fit for the purpose except
that in the wild hashes are difficult to tame.
DOC
end
end
end
11 changes: 11 additions & 0 deletions lib/generators/categoria/templates/data.rb.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

module <%= Rails.application.class.module_parent %>
module <%= domain_module %>
module Data
class <%= data_class_name %> < ::Categoria::Data
end
end
end
end

0 comments on commit 93c7964

Please sign in to comment.