multi_exiftool 0.18.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,207 @@
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ module MultiExiftool
5
+
6
+ # Represents option for the ExifTool command-line application
7
+ class Options
8
+
9
+ # ExifTool option +-b+ (+-binary+) Output metadata in binary format
10
+ attr_accessor :b
11
+
12
+ # ExifTool option <code>-c FMT</code> (+-coordFormat+) Set format for GPS coordinates
13
+ attr_accessor :c
14
+
15
+ # ExifTool option <code>-charset exif=CHARSET</code> Specify encoding for special characters
16
+ attr_accessor :exif_charset
17
+
18
+ # ExifTool option <code>-charset id3=CHARSET</code> Specify encoding for special characters
19
+ attr_accessor :id3_charset
20
+
21
+ # ExifTool option <code>-charset iptc=CHARSE</code> Specify encoding for special characters
22
+ attr_accessor :iptc_charset
23
+
24
+ # ExifTool option <code>-charset photoshop=CHARSET</code> Specify encoding for special characters
25
+ attr_accessor :photoshop_charset
26
+
27
+ # ExifTool option <code>-charset quicktime=CHARSET</code> Specify encoding for special characters
28
+ attr_accessor :quicktime_charset
29
+
30
+ # ExifTool option <code>-charset riff=CHARSET</code> Specify encoding for special characters
31
+ attr_accessor :riff_charset
32
+
33
+ # Exiftool option +-g[NUM...]+ (+-groupHeadings+) Organize output by tag group
34
+ attr_accessor :g
35
+
36
+ # ExifTool option <code>-lang [LANG]</code> Set current language
37
+ attr_accessor :lang
38
+
39
+ # ExifTool option +-n+ (+--printConv+) No print conversion
40
+ attr_accessor :n
41
+
42
+ # ExifTool option +-sort+ Sort output alphabetically
43
+ attr_accessor :sort
44
+
45
+ # ExifTool option +-e+ (+--composite+) Do not generate composite tags
46
+ attr_accessor :e
47
+
48
+ # ExifTool option +-ee[NUM]+ (+-extractEmbedded+) Extract information from embedded files
49
+ attr_accessor :ee
50
+
51
+ # ExifTool option +-F[OFFSET]+ (+-fixBase+) Fix the base for maker notes offsets
52
+ attr_accessor :F
53
+
54
+ # ExifTool option +-fast[NUM]+ Increase speed when extracting metadata
55
+ attr_accessor :fast
56
+
57
+ # ExifTool option +-m+ (+-ignoreMinorErrors+) Ignore minor errors and warnings
58
+ attr_accessor :m
59
+
60
+ # ExifTool option <code>-o OUTFILE</code> (+-out+) Set output file or directory name
61
+ attr_accessor :o
62
+
63
+ # ExifTool option <code>-password PASSWD</code> Password for processing protected files
64
+ attr_accessor :password
65
+
66
+ # ExifTool option <code>-globalTimeShift SHIFT</code> Shift all formatted date/time values
67
+ attr_accessor :globaltimeshift
68
+
69
+ # ExifTool option <code>-config CFGFILE</code> Specify configuration file name
70
+ attr_accessor :config
71
+
72
+ # ExifTool option +-overwrite_original+ Overwrite original by renaming tmp file
73
+ attr_accessor :overwrite_original
74
+
75
+ # ExifTool option +-overwrite_original_in_place+ Overwrite original by copying tmp file
76
+ attr_accessor :overwrite_original_in_place
77
+
78
+ # ExifTool option +-P+ (+-preserve+) Preserve file modification date/time
79
+ attr_accessor :P
80
+
81
+ # ExifTool option <code>-geotag TRKFILE</code> Geotag images from specified GPS log
82
+ attr_accessor :geotag
83
+
84
+ alias :binary :b
85
+ alias :binary= :b= # :nodoc:
86
+ alias :coordformat :c
87
+ alias :coordformat= :c= # :nodoc:
88
+ alias :groupheadings :g
89
+ alias :groupheadings= :g= # :nodoc:
90
+ alias :group :g
91
+ alias :group= :g= # :nodoc:
92
+ alias :noprintconv :n
93
+ alias :noprintconv= :n= # :nodoc:
94
+ alias :numerical :n
95
+ alias :numerical= :n= # :nodoc:
96
+ alias :nocomposite :e
97
+ alias :nocomposite= :e= # :nodoc:
98
+ alias :extractembedded :ee
99
+ alias :extractembedded= :ee= # :nodoc:
100
+ alias :fixbase :F
101
+ alias :fixbase= :F= # :nodoc:
102
+ alias :ignoreminorerrors :m
103
+ alias :ignoreminorerrors= :m= # :nodoc:
104
+ alias :out :o
105
+ alias :out= :o= # :nodoc:
106
+ alias :preserve :P
107
+ alias :preserve= :P= # :nodoc:
108
+
109
+ undef p
110
+
111
+ def initialize values={}
112
+ values.each_pair do |k, v|
113
+ self.send "#{k}=", v
114
+ end
115
+ end
116
+
117
+ def [] opt
118
+ self.send(opt)
119
+ end
120
+
121
+ def []= opt, val
122
+ self.send("#{opt}=", val)
123
+ end
124
+
125
+ def merge other
126
+ Options.new(self.to_h.merge(other.to_h))
127
+ end
128
+
129
+ def to_h
130
+ res = {}
131
+ self.instance_variables.sort.each do |var|
132
+ val = instance_variable_get var
133
+ unless val.nil?
134
+ res[var.to_s.sub(/^@/, '').to_sym] = val
135
+ end
136
+ end
137
+ res
138
+ end
139
+
140
+ alias to_hash to_h
141
+
142
+ # Gets an array of the command-line arguments for this instance (internal
143
+ # use)
144
+ def options_args
145
+ args = []
146
+ to_h.each_pair do |k, v|
147
+ case k.to_s
148
+ when /^(.+)_charset$/
149
+ args << ['-charset', "#{$1}=#{v}"]
150
+ when 'g', 'ee', 'F', 'fast'
151
+ args << "-#{k}#{v}"
152
+ else
153
+ case v
154
+ when true
155
+ args << "-#{k}"
156
+ when nil, false
157
+ else
158
+ args << ["-#{k}", v]
159
+ end
160
+ end
161
+ end
162
+ args.flatten.map(&:to_s)
163
+ end
164
+
165
+ def == other
166
+ to_h == other.to_h
167
+ end
168
+
169
+ private
170
+
171
+ def method_missing meth, *args
172
+ m = try_find_real_method_name(meth)
173
+ if m
174
+ return self.send(m, *args)
175
+ end
176
+ opt = meth.to_s.sub(/=$/, '')
177
+ raise Error.new("option #{opt} is not supported")
178
+ end
179
+
180
+ def respond_to_missing? meth, *args
181
+ !try_find_real_method_name(meth).nil?
182
+ end
183
+
184
+
185
+ def try_find_real_method_name meth
186
+ m = +meth.to_s
187
+ if m =~ /^[a-zA-Z]=?$/
188
+ return nil
189
+ end
190
+ if m =~ /[A-Z]/
191
+ m.downcase!
192
+ if self.respond_to?(m)
193
+ return m
194
+ end
195
+ end
196
+ if m =~ /^[a-z]+(?:_[a-z0-9]+)+/
197
+ m.gsub!('_', '')
198
+ if self.respond_to? m
199
+ return m
200
+ end
201
+ end
202
+ nil
203
+ end
204
+
205
+ end
206
+
207
+ end
@@ -2,6 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require_relative 'executable'
5
+ require_relative 'reader_values'
5
6
  require 'json'
6
7
 
7
8
  module MultiExiftool
@@ -11,36 +12,19 @@ module MultiExiftool
11
12
  # the results as well as possible errors.
12
13
  class Reader
13
14
 
14
- attr_accessor :tags, :group
15
+ attr_accessor :tags
15
16
 
16
17
  include Executable
17
18
 
18
- def initialize filenames=[], opts={}
19
- super(filenames, opts)
20
- if val = opts.delete(:tags)
21
- @tags = val
22
- else
23
- @tags = []
24
- end
25
- if val = opts.delete(:group)
26
- @group = val
27
- end
28
- @options = opts unless opts.empty?
19
+ def initialize filenames=[], *tags_pos, tags: nil, **options
20
+ super(filenames, **options)
21
+ self.tags = tags_pos.flatten + Array(tags)
29
22
  end
30
23
 
31
24
  def self.mandatory_args
32
25
  %w(-J -charset FileName=utf8 -charset utf8)
33
26
  end
34
27
 
35
- # Options to use with the exiftool command.
36
- def options
37
- opts = super
38
- if @group
39
- opts["g#@group"] = true
40
- end
41
- opts
42
- end
43
-
44
28
  # Getting the command-line arguments which would be executed
45
29
  # when calling #read. It could be useful for logging, debugging or
46
30
  # maybe even for creating a batch-file with exiftool command to be
@@ -49,7 +33,7 @@ module MultiExiftool
49
33
  fail MultiExiftool::Error, 'No filenames.' if filenames.empty?
50
34
  cmd = []
51
35
  cmd << Reader.mandatory_args
52
- cmd << options_args
36
+ cmd << options.options_args
53
37
  cmd << tags_args
54
38
  cmd << filenames
55
39
  cmd.flatten
@@ -70,13 +54,17 @@ module MultiExiftool
70
54
 
71
55
  def parse_results
72
56
  stdout = @stdout.read
73
- parse_errors
57
+ parse_messages
74
58
  json = JSON.parse(stdout)
75
- json.map {|values| Values.new(values)}
59
+ json.map {|values| ReaderValues.new(values)}
76
60
  rescue JSON::ParserError
77
61
  return []
78
62
  end
79
63
 
64
+ def parse_messages
65
+ @messages = Messages.new(@stderr.readlines(chomp: true))
66
+ end
67
+
80
68
  end
81
69
 
82
70
  end
@@ -6,10 +6,10 @@ require 'set'
6
6
 
7
7
  module MultiExiftool
8
8
 
9
- # Representing (tag, value) pairs of metadata.
9
+ # Representing (tag, value) pairs of metadata as result of Reader#read.
10
10
  # Access via bracket-methods or dynamic method-interpreting via
11
11
  # method_missing.
12
- class Values
12
+ class ReaderValues
13
13
 
14
14
  # Regular expression to determine timestamp values
15
15
  REGEXP_TIMESTAMP = /^(\d{4}):(\d\d):(\d\d) (\d\d):(\d\d)(?::((?:\d\d)(?:\.\d+)?))?((?:[-+]\d\d:\d\d)|(?:Z))?(?: *DST)?$/
@@ -22,9 +22,9 @@ module MultiExiftool
22
22
  def initialize values
23
23
  @values = {}
24
24
  values.map do |tag,val|
25
- unified_tag = Values.unify_tag(tag)
26
- Values.tag_map[unified_tag] = tag
27
- val = val.kind_of?(Hash) ? Values.new(val) : val
25
+ unified_tag = MultiExiftool.unify_tag(tag)
26
+ ReaderValues.tag_map[unified_tag] = tag
27
+ val = val.kind_of?(Hash) ? ReaderValues.new(val) : val
28
28
  @values[unified_tag] = val
29
29
  end
30
30
  end
@@ -32,13 +32,13 @@ module MultiExiftool
32
32
  # Gets the (posible converted) value for a tag
33
33
  # (tag will be unified, i.e. FNumber, fnumber or f_number
34
34
  # can be used for FNumber)
35
- def [](tag)
36
- unified_tag = Values.unify_tag(tag)
35
+ def [] tag
36
+ unified_tag = MultiExiftool.unify_tag(tag)
37
37
  convert(unified_tag, @values[unified_tag])
38
38
  end
39
39
 
40
40
  # Converts values on the basis of unified tag name and value. It is called
41
- # each time a value is fethed from a Values instance.
41
+ # each time a value is fethed from a ReaderValues instance.
42
42
  # @return (maybe) converted value
43
43
  def convert tag, val
44
44
  return val unless val.kind_of?(String)
@@ -71,12 +71,12 @@ module MultiExiftool
71
71
  # Checks if a tag is present
72
72
  # @param Tag as string or symbol (will be unified)
73
73
  def has_tag? tag
74
- @values.has_key?(Values.unify_tag(tag.to_s))
74
+ @values.has_key?(MultiExiftool.unify_tag(tag))
75
75
  end
76
76
 
77
77
  # Gets the original tag names of this instance
78
78
  def tags
79
- @values.keys.map {|tag| Values.tag_map[tag]}
79
+ @values.keys.map {|tag| ReaderValues.tag_map[tag]}
80
80
  end
81
81
 
82
82
  # Generates a hash representation of this instance
@@ -85,7 +85,7 @@ module MultiExiftool
85
85
  def to_h
86
86
  @values.inject(Hash.new) do |h, a|
87
87
  tag, val = a
88
- h[Values.tag_map[tag]] = convert(Values.unify_tag(tag), val)
88
+ h[ReaderValues.tag_map[tag]] = convert(MultiExiftool.unify_tag(tag), val)
89
89
  h
90
90
  end
91
91
  end
@@ -98,14 +98,10 @@ module MultiExiftool
98
98
 
99
99
  attr_reader :tag_map
100
100
 
101
- def unify_tag tag
102
- tag.gsub(/[-_]/, '').downcase
103
- end
104
-
105
101
  end
106
102
 
107
- def method_missing tag, *args, &block
108
- res = self[Values.unify_tag(tag.to_s)]
103
+ def method_missing meth, *args, &block
104
+ res = self[MultiExiftool.unify_method(meth)]
109
105
  if res && block_given?
110
106
  if block.arity > 0
111
107
  yield res
@@ -116,9 +112,10 @@ module MultiExiftool
116
112
  res
117
113
  end
118
114
 
119
- def respond_to_missing? tag, *args
120
- has_tag?(tag) || super
115
+ def respond_to_missing? meth, *args
116
+ has_tag?(MultiExiftool.unify_method(meth)) || super
121
117
  end
118
+
122
119
  end
123
120
 
124
121
  end
@@ -2,6 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require_relative 'executable'
5
+ require_relative 'writer_values'
5
6
 
6
7
  module MultiExiftool
7
8
 
@@ -10,26 +11,32 @@ module MultiExiftool
10
11
  # possible errors.
11
12
  class Writer
12
13
 
13
- attr_accessor :overwrite_original, :values
14
+ attr_accessor :values
14
15
 
15
16
  include Executable
16
17
 
17
- def initialize filenames=[], values={}, opts={}
18
- super(filenames, opts)
19
- @values = values
18
+ def initialize filenames=[], values=nil, **vals_and_opts
19
+ if values
20
+ options = vals_and_opts
21
+ else
22
+ options = Options.new
23
+ values = {}
24
+ vals_and_opts.each_pair do |k, v|
25
+ if options.respond_to? k
26
+ options[k] = v
27
+ else
28
+ values[k] = v
29
+ end
30
+ end
31
+ end
32
+ super(filenames, **options)
33
+ self.values = values
20
34
  end
21
35
 
22
36
  def self.mandatory_args
23
37
  %w(-charset FileName=utf8 -charset utf8)
24
38
  end
25
39
 
26
- # Options to use with the exiftool command.
27
- def options
28
- opts = super
29
- opts[:overwrite_original] = true if @overwrite_original
30
- opts
31
- end
32
-
33
40
  # Getting the command-line arguments which would be executed
34
41
  # when calling #write. It could be useful for logging, debugging or
35
42
  # maybe even for creating a batch-file with exiftool command to be
@@ -38,33 +45,22 @@ module MultiExiftool
38
45
  fail MultiExiftool::Error, 'No filenames.' if filenames.empty?
39
46
  cmd = []
40
47
  cmd << Writer.mandatory_args
41
- cmd << options_args
42
- cmd << values_args
48
+ cmd << options.options_args
49
+ cmd << values.values_args
43
50
  cmd << filenames
44
51
  cmd.flatten
45
52
  end
46
53
 
47
54
  alias write execute # :nodoc:
48
55
 
49
- private
56
+ alias vals values
57
+ alias vals= values=
50
58
 
51
- def values_args
52
- raise MultiExiftool::Error.new('No values.') if values.empty?
53
- values_to_param_array(@values).map {|arg| "-#{arg}"}
54
- end
55
-
56
- def values_to_param_array hash
57
- res = []
58
- hash.each do |tag, val|
59
- if val.respond_to? :to_hash
60
- res << values_to_param_array(val.to_hash).map {|arg| "#{tag}:#{arg}"}
61
- elsif val.respond_to? :to_ary
62
- res << val.map {|v| "#{tag}=#{v}"}
63
- else
64
- res << "#{tag}=#{val}"
65
- end
59
+ def values= vals
60
+ unless vals.kind_of? WriterValues
61
+ vals = WriterValues.new(vals)
66
62
  end
67
- res.flatten
63
+ @values = vals
68
64
  end
69
65
 
70
66
  end
@@ -0,0 +1,91 @@
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ module MultiExiftool
5
+
6
+ # Representing (tag, value) pairs of metadata to use with Writer#write.
7
+ # Access via bracket-methods or dynamic method-interpreting via
8
+ # method_missing.
9
+ class WriterValues
10
+
11
+ def initialize values={}
12
+ @values = {}
13
+ values.each_pair do |k, v|
14
+ self[k] = v
15
+ end
16
+ end
17
+
18
+ # Gets the value for a tag (tag will be unified, i.e. FNumber, fnumber or
19
+ # f_number can be used for FNumber)
20
+ def [] tag
21
+ unified_tag = MultiExiftool.unify_tag(tag)
22
+ @values[unified_tag]
23
+ end
24
+
25
+ # Sets the value for a tag (tag will be unified, i.e. FNumber, fnumber or
26
+ # f_number can be used for FNumber)
27
+ def []= tag, val
28
+ unified_tag = MultiExiftool.unify_tag(tag)
29
+ if val.respond_to?(:to_hash) && !val.kind_of?(WriterValues)
30
+ val = WriterValues.new(val)
31
+ end
32
+ @values[unified_tag] = val
33
+ end
34
+
35
+ def empty?
36
+ @values.empty?
37
+ end
38
+
39
+ # Gets a hash representation of this instance
40
+ def to_h
41
+ @values
42
+ end
43
+
44
+ alias to_hash to_h
45
+
46
+ # Gets an array of the command-line arguments for this instance (internal
47
+ # use)
48
+ def values_args
49
+ raise MultiExiftool::Error.new('No values.') if @values.empty?
50
+ values_to_param_array(@values).map {|arg| "-#{arg}"}
51
+ end
52
+
53
+ private
54
+
55
+ def values_to_param_array hash
56
+ res = []
57
+ hash.each do |tag, val|
58
+ if val.respond_to? :to_hash
59
+ res << values_to_param_array(val.to_hash).map {|arg| "#{tag}:#{arg}"}
60
+ elsif val.respond_to? :to_ary
61
+ res << val.map {|v| "#{tag}=#{v}"}
62
+ else
63
+ res << "#{tag}=#{val}"
64
+ end
65
+ end
66
+ res.flatten
67
+ end
68
+
69
+ def method_missing meth, val=nil, &block
70
+ unified_meth = MultiExiftool.unify_method(meth)
71
+ if unified_meth =~ /^(.+)=$/
72
+ self[$1] = val
73
+ else
74
+ res = self[unified_meth]
75
+ if block_given?
76
+ res = WriterValues.new unless res
77
+ self[unified_meth] = res
78
+ if block.arity > 0
79
+ yield res
80
+ else
81
+ res.instance_eval &block
82
+ end
83
+ end
84
+ res
85
+ end
86
+ end
87
+
88
+ end
89
+
90
+ end
91
+
@@ -1,14 +1,14 @@
1
1
  # encoding: utf-8
2
2
  # frozen_string_literal: true
3
3
 
4
- require_relative 'multi_exiftool/values'
4
+ require_relative 'multi_exiftool/options'
5
5
  require_relative 'multi_exiftool/reader'
6
6
  require_relative 'multi_exiftool/writer'
7
7
  require_relative 'multi_exiftool/batch'
8
8
 
9
9
  module MultiExiftool
10
10
 
11
- VERSION = '0.18.1'
11
+ VERSION = '1.0.0'
12
12
 
13
13
  @exiftool_command = 'exiftool'
14
14
 
@@ -19,30 +19,30 @@ module MultiExiftool
19
19
  # values, errors
20
20
  #
21
21
  # Example:
22
- # values, errors = MultiExiftool.read(Dir['*.jpg'])
23
- # if errors.empty?
24
- # values.each {|val| do_something_with(val) }
25
- # else
22
+ # values, messages = MultiExiftool.read(Dir['*.jpg'])
23
+ # if messages.errors_or_warnings?
26
24
  # # error handling
25
+ # else
26
+ # values.each {|val| do_something_with(val) }
27
27
  # end
28
- def read filenames, opts={}
29
- reader = Reader.new(filenames, opts)
28
+ def read filenames, *tags_pos, tags: nil, **opts
29
+ reader = Reader.new(filenames, *tags_pos, tags: tags, **opts)
30
30
  values = reader.read
31
- [values, reader.errors]
31
+ [values, reader.messages]
32
32
  end
33
33
 
34
34
  # Writing metadata
35
35
  # Returns an array of the error messages
36
36
  #
37
37
  # Example:
38
- # errors = MultiExiftool.write(Dir['*.jpg'], {author: 'Jan Friedrich'})
39
- # unless errors.empty?
38
+ # messages = MultiExiftool.write(Dir['*.jpg'], {author: 'Jan Friedrich'})
39
+ # if messages.errors_or_warnings?
40
40
  # # do error handling
41
41
  # end
42
- def write filenames, values, opts={}
43
- writer = Writer.new(filenames, values, opts)
42
+ def write filenames, values=nil, **vals_and_opts
43
+ writer = Writer.new(filenames, values, **vals_and_opts)
44
44
  writer.write
45
- writer.errors
45
+ writer.messages
46
46
  end
47
47
 
48
48
  # Deleting metadata
@@ -50,18 +50,17 @@ module MultiExiftool
50
50
  #
51
51
  # Examples:
52
52
  # # delete values for all tags
53
- # errors = MultiExiftool.delete_values(Dir['*.jpg'])
54
- # unless errors.empty?
53
+ # messages = MultiExiftool.delete_values(Dir['*.jpg'])
54
+ # if messages.errors_or_warnings?
55
55
  # # do error handling
56
56
  # end
57
57
  #
58
58
  # # delete values for tags Author and Title
59
- # errors = MultiExiftool.delete_values(Dir['*.jpg'], %w[author title])
60
- # unless errors.empty?
59
+ # messages = MultiExiftool.delete_values(Dir['*.jpg'], %w[author title])
60
+ # if messages.errors_or_warnings?
61
61
  # # do error handling
62
62
  # end
63
- def delete_values filenames, opts={}
64
- tags = opts.fetch(:tags, :all)
63
+ def delete_values filenames, tags: :all
65
64
  values = Array(tags).inject(Hash.new) {|h,tag| h[tag] = nil; h}
66
65
  write(filenames, values)
67
66
  end
@@ -71,11 +70,11 @@ module MultiExiftool
71
70
  # Returns an array of the error messages
72
71
  #
73
72
  # Example:
74
- # errors = MultiExiftool.batch do
73
+ # messages = MultiExiftool.batch do
75
74
  # Dir['*.jpg'].each_with_index do |filename, i|
76
75
  # write filename, {author: 'Jan Friedrich', comment: "This is file number #{i+1}."}
77
76
  # end
78
- # unless errors.empty?
77
+ # if messages.errors_or_warnings?
79
78
  # # do error handling
80
79
  # end
81
80
  def batch &block
@@ -86,7 +85,7 @@ module MultiExiftool
86
85
  yield batch
87
86
  end
88
87
  batch.execute
89
- batch.errors
88
+ batch.messages
90
89
  end
91
90
 
92
91
  attr_accessor :exiftool_command
@@ -103,6 +102,20 @@ module MultiExiftool
103
102
  @exiftool_version ||= `#{exiftool_command} -ver`.to_f
104
103
  end
105
104
 
105
+ # :nodoc:
106
+
107
+ # Converts a tag name into a unified form by converting it with to_s and
108
+ # downcasing it
109
+ def unify_tag name
110
+ name.to_s.downcase
111
+ end
112
+
113
+ # Converts a method name into a unified form by converting it with to_s and
114
+ # removing underscores and downcasing it
115
+ def unify_method name
116
+ name.to_s.gsub('_', '').downcase
117
+ end
118
+
106
119
  end
107
120
 
108
121
  class Error < ::StandardError; end