diff options
author | Akira Matsuda <ronnie@dio.jp> | 2017-01-13 15:09:56 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2017-01-13 15:13:47 +0900 |
commit | 9360b6be63b7a452535699bcf6ae853df7f5eea7 (patch) | |
tree | d1ad1280439883cf0fb328efe45e09dfa581182f /railties/lib/rails | |
parent | be5ddc250874e6c7f4d22e34791f5187448ebb0e (diff) | |
download | rails-9360b6be63b7a452535699bcf6ae853df7f5eea7.tar.gz rails-9360b6be63b7a452535699bcf6ae853df7f5eea7.tar.bz2 rails-9360b6be63b7a452535699bcf6ae853df7f5eea7.zip |
class Foo < Struct.new(:x) creates an extra unneeded anonymous class
because Struct.new returns a Class, we just can give it a name and use it directly without inheriting from it
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/generators/app_base.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/source_annotation_extractor.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb index ea88afe9f4..2297a31b6d 100644 --- a/railties/lib/rails/generators/app_base.rb +++ b/railties/lib/rails/generators/app_base.rb @@ -209,7 +209,7 @@ module Rails !options[:skip_active_record] && options[:database] == "sqlite3" end - class GemfileEntry < Struct.new(:name, :version, :comment, :options, :commented_out) + GemfileEntry = Struct.new(:name, :version, :comment, :options, :commented_out) do def initialize(name, version, comment, options = {}, commented_out = false) super end diff --git a/railties/lib/rails/source_annotation_extractor.rb b/railties/lib/rails/source_annotation_extractor.rb index 3a48c4c496..e9088c44ce 100644 --- a/railties/lib/rails/source_annotation_extractor.rb +++ b/railties/lib/rails/source_annotation_extractor.rb @@ -13,7 +13,7 @@ # start with the tag optionally followed by a colon. Everything up to the end # of the line (or closing ERB comment tag) is considered to be their text. class SourceAnnotationExtractor - class Annotation < Struct.new(:line, :tag, :text) + Annotation = Struct.new(:line, :tag, :text) do def self.directories @@directories ||= %w(app config db lib test) + (ENV["SOURCE_ANNOTATION_DIRECTORIES"] || "").split(",") end |