lib/hanami/commands/generate/mailer.rb in hanami-1.0.0.beta2 vs lib/hanami/commands/generate/mailer.rb in hanami-1.0.0.beta3
- old
+ new
@@ -1,16 +1,26 @@
require "hanami/commands/generate/abstract"
module Hanami
+ # @api private
module Commands
+ # @api private
class Generate
# @since 0.5.0
# @api private
class Mailer < Abstract
+ # @api private
+ attr_reader :name
+ # @api private
+ attr_reader :name_underscored
+ # @api private
+ attr_reader :from
+ # @api private
+ attr_reader :to
+ # @api private
+ attr_reader :subject
- attr_reader :name, :name_underscored, :from, :to, :subject
-
# @since 0.5.0
# @api private
TXT_FORMAT = ".txt".freeze
# @since 0.5.0
@@ -45,19 +55,20 @@
@subject = options[:subject] || DEFAULT_SUBJECT
assert_name!
end
- # @since 0.x.x
+ # @since 0.5.0
# @api private
def map_templates
add_mapping("mailer_spec.rb.#{test_framework.framework}.tt", mailer_spec_path)
add_mapping("mailer.rb.tt", mailer_path)
add_mapping("template.txt.tt", txt_template_path)
add_mapping("template.html.tt", html_template_path)
end
+ # @api private
def template_options
{
mailer: name,
from: from,
to: to,
@@ -103,13 +114,15 @@
# @api private
def template_path(format)
core_root.join("mailers", "templates", "#{ name_underscored }#{ format }.#{ DEFAULT_ENGINE }")
end
+ # @api private
def spec_root
Pathname.new("spec")
end
+ # @api private
def core_root
Pathname.new("lib").join(project_name)
end
end
end