Skip to content

Commit

Permalink
Merge 8215df9 into a9026fd
Browse files Browse the repository at this point in the history
  • Loading branch information
chopraanmol1 committed Jan 8, 2019
2 parents a9026fd + 8215df9 commit 4b05c3a
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 68 deletions.
9 changes: 0 additions & 9 deletions .travis.yml
@@ -1,6 +1,5 @@
language: ruby
rvm:
- 2.2
- 2.3
- 2.4
- 2.5
Expand All @@ -11,14 +10,6 @@ env:
- LONG_RUN=true
matrix:
include:
- rvm: 2.0
gemfile: Gemfile_ruby2
before_install:
- gem install bundler -v '< 2'
- rvm: 2.1
gemfile: Gemfile_ruby2
before_install:
- gem install bundler -v '< 2'
- rvm: 2.6
env: RUBYOPT=--jit LONG_RUN=true
- rvm: ruby-head
Expand Down
30 changes: 0 additions & 30 deletions Gemfile_ruby2

This file was deleted.

3 changes: 0 additions & 3 deletions README.md
Expand Up @@ -288,9 +288,6 @@ You can run the tests/examples with Rspec like reporters by running
Roo also has a few tests that take a long time (5+ seconds). To run these, use
`LONG_RUN=true bundle exec rake`

When testing using Ruby 2.0 or 2.1, use this command:
`BUNDLE_GEMFILE=Gemfile_ruby2 bundle exec rake`

### Issues

If you find an issue, please create a gist and refer to it in an issue ([sample gist](https://gist.github.com/stevendaniels/98a05849036e99bb8b3c)). Here are some instructions for creating such a gist.
Expand Down
2 changes: 1 addition & 1 deletion lib/roo/excelx.rb
Expand Up @@ -464,7 +464,7 @@ def process_zipfile_entries(entries)
end

def safe_send(object, method, *args)
object.send(method, *args) if object && object.respond_to?(method)
object.send(method, *args) if object&.respond_to?(method)
end

def worksheet_types
Expand Down
3 changes: 1 addition & 2 deletions lib/roo/excelx/cell.rb
Expand Up @@ -40,8 +40,7 @@ def type
end

def self.create_cell(type, *values)
type_class = cell_class(type)
type_class && type_class.new(*values)
cell_class(type)&.new(*values)
end

def self.cell_class(type)
Expand Down
6 changes: 3 additions & 3 deletions lib/roo/excelx/shared_strings.rb
Expand Up @@ -40,7 +40,7 @@ def extract_shared_strings
document = fix_invalid_shared_strings(doc)
# read the shared strings xml document
document.xpath('/sst/si').map do |si|
shared_string = String.new
shared_string = +""
si.children.each do |elem|
case elem.name
when 'r'
Expand Down Expand Up @@ -90,7 +90,7 @@ def extract_html
#
# Expected Output ::: "<html><sub|sup><b><i><u>TEXT</u></i></b></sub|/sup></html>"
def extract_html_r(r_elem)
str = String.new
str = +""
xml_elems = {
sub: false,
sup: false,
Expand Down Expand Up @@ -135,7 +135,7 @@ def extract_html_r(r_elem)

# This will return an html string
def create_html(text, formatting)
tmp_str = String.new
tmp_str = +""
formatting.each do |elem, val|
tmp_str << "<#{elem}>" if val
end
Expand Down
14 changes: 5 additions & 9 deletions lib/roo/excelx/sheet.rb
Expand Up @@ -27,11 +27,9 @@ def present_cells
warn %{
[DEPRECATION] present_cells is deprecated. Alternate:
with activesupport => cells[key].presence
without activesupport
(ruby -v >= 2.3) => cells[key]&.presence
(ruby -v < 2.3) => (cell = cells[key]) && cell.presence
without activesupport => cells[key]&.presence
}
cells.select { |_, cell| cell && cell.presence }
cells.select { |_, cell| cell&.presence }
end
end

Expand All @@ -52,15 +50,13 @@ def each_row(options = {}, &block)

def row(row_number)
first_column.upto(last_column).map do |col|
cell = cells[[row_number, col]]
cell && cell.value
cells[[row_number, col]]&.value
end
end

def column(col_number)
first_row.upto(last_row).map do |row|
cell = cells[[row, col_number]]
cell && cell.value
cells[[row, col_number]]&.value
end
end

Expand Down Expand Up @@ -128,7 +124,7 @@ def first_last_row_col
first_row = last_row = first_col = last_col = nil

cells.each do |(row, col), cell|
next unless cell && cell.presence
next unless cell&.presence
first_row ||= row
last_row ||= row
first_col ||= col
Expand Down
2 changes: 1 addition & 1 deletion lib/roo/excelx/sheet_doc.rb
Expand Up @@ -98,7 +98,7 @@ def cell_from_xml(cell_xml, hyperlink, coordinate, empty_cell=true)
cell_xml_children.each do |cell|
case cell.name
when 'is'
content = String.new
content = +""
cell.children.each do |inline_str|
if inline_str.name == 't'
content << inline_str.content
Expand Down
22 changes: 12 additions & 10 deletions roo.gemspec
Expand Up @@ -4,18 +4,20 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'roo/version'

Gem::Specification.new do |spec|
spec.name = 'roo'
spec.version = Roo::VERSION
spec.authors = ['Thomas Preymesser', 'Hugh McGowan', 'Ben Woosley', 'Oleksandr Simonov', 'Steven Daniels']
spec.email = ['ruby.ruby.ruby.roo@gmail.com', 'oleksandr@simonov.me']
spec.summary = 'Roo can access the contents of various spreadsheet files.'
spec.description = "Roo can access the contents of various spreadsheet files. It can handle\n* OpenOffice\n* Excelx\n* LibreOffice\n* CSV"
spec.homepage = 'https://github.com/roo-rb/roo'
spec.license = 'MIT'
spec.name = 'roo'
spec.version = Roo::VERSION
spec.authors = ['Thomas Preymesser', 'Hugh McGowan', 'Ben Woosley', 'Oleksandr Simonov', 'Steven Daniels']
spec.email = ['ruby.ruby.ruby.roo@gmail.com', 'oleksandr@simonov.me']
spec.summary = 'Roo can access the contents of various spreadsheet files.'
spec.description = "Roo can access the contents of various spreadsheet files. It can handle\n* OpenOffice\n* Excelx\n* LibreOffice\n* CSV"
spec.homepage = 'https://github.com/roo-rb/roo'
spec.license = 'MIT'

spec.files = `git ls-files -z`.split("\x0")
spec.files = `git ls-files -z`.split("\x0")
spec.files.reject! { |fn| fn.include?('test/files') }
spec.require_paths = ['lib']
spec.require_paths = ['lib']

spec.required_ruby_version = ">= 2.3.0"

spec.add_dependency 'nokogiri', '~> 1'
spec.add_dependency 'rubyzip', '>= 1.2.1', '< 2.0.0'
Expand Down

0 comments on commit 4b05c3a

Please sign in to comment.