Reactコンポーネントをレンダリングし、テストユーティリティを返す
import { render } from '@testing-library/react-native'| if RUBY_VERSION == "1.8.7" | |
| nasty_control_char_matcher = Regexp.new("[\x01\x02\x03\x04\x05\x06\x07\x08\x1F\v\xE2]") | |
| else | |
| nasty_control_char_matcher = Regexp.new("[\x01\x02\x03\x04\x05\x06\x07\x08\x1F\v\u2028]") | |
| end |
| class Array | |
| # A more meaningful message when you have an insufficient number of columns | |
| # in a row for transposition. | |
| MSG_TRANSPOSE_INDEX_ERROR = "Row %s has only %s element(s), but transposition | |
| requires %s. Please specify a block to populate missing items or adjust | |
| your array to contain an equal number of elements in each row array." | |
| # Overrides the default transpose method to allow a block that can be used to return | |
| # elements required to populate the transposition. |
| require 'axlsx' | |
| p = Axlsx::Package.new | |
| wb = p.workbook | |
| wb.add_worksheet(:name => 'defined name') do |sheet| | |
| sheet.add_row [1, 2, 17, '=FOOBAR'] | |
| wb.add_defined_name("'defined name'!$C1", :local_sheet_id => sheet.index, :name => 'FOOBAR') | |
| end | |
| p.serialize 'custom_defined_name' |
| # encoding: UTF-8 | |
| # | |
| require 'nkf' | |
| class PhoneticMap | |
| def data | |
| @data ||= build_data | |
| end | |
| def index_of(string) |
| require 'axlsx' | |
| p = Axlsx::Package.new | |
| p.workbook do |wb| | |
| # Stuff like this is why I LOVE RUBY | |
| # If you dont know about hash default values | |
| # LEARN IT! LIVE IT! LOVE IT! | |
| defaults = { :style => :thick, :color => "000000" } | |
| borders = Hash.new do |hash, key| | |
| hash[key] = wb.styles.add_style :border => defaults.merge( { :edges => key.to_s.split('_').map(&:to_sym) } ) |
| #```ruby | |
| wb.add_worksheet(name: 'outline_level') do |sheet| | |
| sheet.add_row [1, 2, 3, 4, Time.now, 149455.15] | |
| sheet.add_row [1, 2, 5, 6, Time.now,14100.19] | |
| sheet.add_row [9500002267, 1212, 1212, Time.now,14100.19] | |
| sheet.add_row [], :collapsed => 1 | |
| sheet.rows[0..2].each do |row| | |
| row.outline_level = 1 | |
| # This will collapse the outline level rows |
| # Hacking comment position! | |
| # Use at your own risk :) | |
| # add_comment is the preferred way to add comments to your worksheet. However, if you really need to position a | |
| # a specific comment, here is one way to do it. | |
| require 'axlsx' | |
| p = Axlsx::Package.new | |
| wb = p.workbook | |
| wb.add_worksheet(:name => 'comments') do |sheet| | |
| sheet.add_row ['Can we build it?', 'Yes we can!'] | |
| sheet.add_comment(:ref => 'A1', :author => 'Bob', :text => 'Yes We Can!').tap do |comment| |