Removes code duplication (code climate)

No gain but it's "better": https://codeclimate.com/github/Mogztter/asciidoctor/compare/code-climate
And if colspec is nil or empty that won't be a problem either ?
I like it, the assignment is straight forward but some will disagree
because we put something in to remove it later.
@mojavelinux Do you have an opinion on this ?
Le 27 oct. 2014 01:20, "Jakub Jirutka" <notifications@github.com> a écrit :

> In lib/asciidoctor/parser.rb:
>
> > @@ -2471,6 +2472,15 @@ def self.parse_cell_spec(line, pos = :start, delimiter = nil)
> >      [spec, rest]
> >    end
> >
> > +  def self.parse_col_row_spec(colspec, rowspec, spec)
> > +    if !colspec.nil_or_empty? && Table::ALIGNMENTS[:h].has_key?(colspec)
> > +      spec['halign'] = Table::ALIGNMENTS[:h][colspec]
> > +    end
> > +    if !rowspec.nil_or_empty? && Table::ALIGNMENTS[:v].has_key?(rowspec)
> > +      spec['valign'] = Table::ALIGNMENTS[:v][rowspec]
> > +    end
> > +  end
>
> Something like this:
>
> colspec, rowspec = m[3].split '.'spec['halign'] = Table::ALIGNMENTS[:h][colspec]spec['valign'] = Table::ALIGNMENTS[:v][rowspec]...spec.delete_if { |_, v| v.nil_or_empty? }
>
> Note: It’s not necessary to check if a hash contains a key to get its
> value — when the key doesn’t exist (or is nil), it just returns nil.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/asciidoctor/asciidoctor/pull/1165/files#r19385369>.
>