Skip to content
7 changes: 4 additions & 3 deletions babelish.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ Gem::Specification.new do |s|
- .strings (iOS)
- .xml (Android)
- .json
- .php"
s.authors = ["François Benaiteau", "Markus Paeschke"]
s.email = ['francois.benaiteau@gmail.com', 'markus.paeschke@gmail.com']
- .php
- .yaml (Rails)"
s.authors = ["François Benaiteau", "Markus Paeschke", "Nikolay Moskvin"]
s.email = ['francois.benaiteau@gmail.com', 'markus.paeschke@gmail.com', 'nikolay.moskvin@gmail.com']
s.homepage = 'http://netbe.github.io/Babelish/'
s.license = 'MIT'

Expand Down
1 change: 1 addition & 0 deletions lib/babelish.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def to_utf8
require "babelish/csv2android"
require "babelish/csv2php"
require "babelish/csv2json"
require "babelish/csv2yaml"

# To CSV
require "babelish/base2csv"
Expand Down
34 changes: 34 additions & 0 deletions lib/babelish/csv2yaml.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module Babelish

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing magic comment # frozen_string_literal: true.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rubocop | grep frozen_string_literal does not have it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/FrozenStringLiteralComment: Missing magic comment # frozen_string_literal: true.

# Converter from csv format to Rails like yaml format
class CSV2YAML < Csv2Base
attr_accessor :is_first_row

def initialize(filename, langs, args = {})
super(filename, langs, args)
@is_first_row = true
end

def language_filepaths(language)
require 'pathname'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not agree with the bot

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

filename = @output_basename || language.code
filepath = Pathname.new("#{@output_dir}/#{filename}.#{extension}")
@language = language
filepath ? [filepath] : []
end

def get_row_format(row_key, row_value, comment = nil, _indentation = 0)
entry = ''

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will not fix it!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

if @is_first_row
entry += "#{@language.code}:\n"
@is_first_row = false
end
indent = ' '

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not agree with the bot

entry << "#{indent}# #{comment}\n" unless comment.to_s.empty?
entry << "#{indent}#{row_key}: \"#{row_value}\"\n"
end

def extension
'yaml'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will not fix it!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

end
end
end
2 changes: 1 addition & 1 deletion lib/babelish/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Babelish
VERSION = "0.5.4"
VERSION = "0.6.0".freeze
end