rggen 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ae419a5f6e280921fc5527d3e697856fdda719cb7b381a59f34cbb23cb6bcab
4
- data.tar.gz: ca6ea865dd6abef639b4f171bba9899132a56ddaa3eeacffa43d003ded1e801a
3
+ metadata.gz: 8557db72205fd083dafe52498b9739d454ad263472beb66607409ca4641fd0b2
4
+ data.tar.gz: e5373123cdf438cf0a8d59a8c98d80268baaa3733eb97e76ff3b9215a3e5cd3a
5
5
  SHA512:
6
- metadata.gz: 5e064c1d08c1dd8edc12253eecfd963b4b10da727741d66f56299732e3ac902ef35ecbdeed4b7d462e6ecdb983ee18ab237d1c7ebf5dde5fa98e326c7ee6a932
7
- data.tar.gz: 99b98435e35e3c9b06ba268a623768ad70588dbecd16ccc9a6dd738933302cd72f36b57abbb89e547719ba3e875b0cd09c017d650bb95e38a31df0d639edb885
6
+ metadata.gz: c68809dcf02ebbc254eb88b7b54fde450213bfbbcdb18b0c83bfd319fdfa711fbda93b94108a3521a131e57b93db2ff2f689c8935a97c646a63bd6d7b40b08e9
7
+ data.tar.gz: a433ecd75b2c6ee8d2a34ecc654b0cf4672530bd5bc7f86c62e9db132cff032a757e6ad7098f8ca49573b5f6867b47335d1cdeccbbcde7824b83fcc1226a1785
@@ -2,7 +2,7 @@ simple_item :bit_field, :reference do
2
2
  register_map do
3
3
  field :reference, need_validation: true, forward_to: :find_reference
4
4
  field :has_reference? do
5
- @reference.not.empty?
5
+ !(@reference.nil? || @reference.empty?)
6
6
  end
7
7
 
8
8
  build do |cell|
@@ -1,6 +1,4 @@
1
1
  loader :register_map, [:csv, :tsv] do
2
- require 'csv'
3
-
4
2
  def load_file(file)
5
3
  create_map(file) do |map|
6
4
  sheet_name = File.basename(file, '.*')
@@ -1,6 +1,4 @@
1
1
  loader :register_map, :xls do
2
- require 'spreadsheet'
3
-
4
2
  def load_file(file)
5
3
  create_map(file) do |map|
6
4
  load_spreadsheet(file).each do |worksheet|
@@ -1,6 +1,4 @@
1
1
  loader :register_map, [:xlsx, :ods] do
2
- require 'roo'
3
-
4
2
  def load_file(file)
5
3
  create_map(file) do |map|
6
4
  load_spreadsheet(file).each do |sheet_name, sheet|
@@ -12,13 +10,12 @@ loader :register_map, [:xlsx, :ods] do
12
10
  def load_spreadsheet(file)
13
11
  sheets = {}
14
12
  Roo::Spreadsheet.open(file).each_with_pagename do |sheet_name, sheet|
15
- next unless sheet.first_row
16
- sheets[sheet_name] = 1.upto(sheet.last_row).map do |row|
17
- 1.upto(sheet.last_column).map do |column|
18
- sheet.cell(row, column)
19
- end
20
- end
13
+ sheet.first_row && (sheets[sheet_name] = process_sheet(sheet))
21
14
  end
22
15
  sheets
23
16
  end
17
+
18
+ def process_sheet(sheet)
19
+ sheet.to_table(from_column: 1)
20
+ end
24
21
  end
@@ -1,18 +1,16 @@
1
1
  require 'facets/enumerable/exclude'
2
2
  require 'facets/enumerable/find_yield'
3
- require 'facets/enumerable/sum' unless Enumerable.public_method_defined?(:sum)
3
+ require 'facets/enumerable/sum' if RUBY_VERSION < '2.4'
4
4
  require 'facets/file/ext'
5
5
  require 'facets/hash/symbolize_keys'
6
6
  require 'facets/integer/multiple'
7
7
  require 'facets/kernel/attr_singleton'
8
8
  require 'facets/kernel/not'
9
9
  require 'facets/kernel/not_nil'
10
- require 'facets/method/curry' unless Method.public_method_defined?(:curry)
11
10
  require 'facets/module/attr_class_accessor'
12
11
  require 'facets/module/attr_setter'
13
12
  require 'facets/module/lastname'
14
13
  require 'facets/numeric/positive'
15
- require 'facets/object/itself' unless Object.public_method_defined?(:itself)
16
14
  require 'facets/pathname/to_path'
17
15
  require 'facets/pathname/to_str'
18
16
  require 'facets/range/overlap'
@@ -0,0 +1,17 @@
1
+ module Roo
2
+ module TableFormatter
3
+ def to_table(sheet = default_sheet, **options)
4
+ from_row = options[:from_row] || first_row(sheet)
5
+ to_row = options[:to_row] || last_row(sheet)
6
+ from_column = options[:from_column] || first_column(sheet)
7
+ to_column = options[:to_column] || last_column(sheet)
8
+ from_row.upto(to_row).map do |row|
9
+ from_column.upto(to_column).map { |column| cell(row, column, sheet) }
10
+ end
11
+ end
12
+ end
13
+
14
+ class Base
15
+ include TableFormatter
16
+ end
17
+ end
data/lib/rggen/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module RgGen
2
2
  MAJOR = 0
3
3
  MINOR = 8
4
- TEENY = 0
4
+ TEENY = 1
5
5
  VERSION = "#{MAJOR}.#{MINOR}.#{TEENY}".freeze
6
6
  end
data/lib/rggen.rb CHANGED
@@ -4,6 +4,9 @@ module RgGen
4
4
  require 'pathname'
5
5
  require 'optparse'
6
6
  require 'erubi'
7
+ require 'csv'
8
+ require 'roo'
9
+ require 'spreadsheet'
7
10
 
8
11
  require_relative 'rggen/version'
9
12
  require_relative 'rggen/rggen_home'
@@ -15,6 +18,7 @@ module RgGen
15
18
  require_relative 'rggen/core_extensions/forwardable'
16
19
  require_relative 'rggen/core_extensions/integer'
17
20
  require_relative 'rggen/core_extensions/math'
21
+ require_relative 'rggen/core_extensions/roo'
18
22
 
19
23
  require_relative 'rggen/base/hierarchical_accessors'
20
24
  require_relative 'rggen/base/hierarchical_item_accessors'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rggen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taichi Ishitani
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-31 00:00:00.000000000 Z
11
+ date: 2019-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: erubi
@@ -257,6 +257,7 @@ files:
257
257
  - lib/rggen/core_extensions/forwardable.rb
258
258
  - lib/rggen/core_extensions/integer.rb
259
259
  - lib/rggen/core_extensions/math.rb
260
+ - lib/rggen/core_extensions/roo.rb
260
261
  - lib/rggen/exceptions.rb
261
262
  - lib/rggen/generator.rb
262
263
  - lib/rggen/input_base/component.rb
@@ -339,8 +340,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
339
340
  - !ruby/object:Gem::Version
340
341
  version: '0'
341
342
  requirements: []
342
- rubyforge_project:
343
- rubygems_version: 2.7.6
343
+ rubygems_version: 3.0.3
344
344
  signing_key:
345
345
  specification_version: 4
346
346
  summary: Code generation tool for control registers in a SoC design.