Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file removed .gemtest
Empty file.
6 changes: 6 additions & 0 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "bundler"
directory: "/"
schedule:
interval: "daily"
16 changes: 16 additions & 0 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Build and Test
on: [push, pull_request]
jobs:
test:
strategy:
fail-fast: false
matrix:
ruby: ["2.6", "2.7", "3.0"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bundle exec rake
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ tmp/
.bundle/
vendor/
.idea/

Gemfile.lock
1 change: 0 additions & 1 deletion .ruby-gemset

This file was deleted.

2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.3
3.0.3
31 changes: 0 additions & 31 deletions .travis.yml

This file was deleted.

16 changes: 2 additions & 14 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
source 'https://rubygems.org'
# frozen_string_literal: true

# Specify your gem's dependencies in rubytree.gemspec
source "https://rubygems.org"
gemspec

group :development, :test do
gem 'rake', '>= 13.0.1'
gem 'test-unit', '~> 3.3.6'
gem 'coveralls', '>= 0.8.23', :require => false, :platforms => :mri_21
gem 'rspec', '>= 3.9.0'
gem 'rubocop'
end

# Local Variables:
# mode: ruby
# End:
91 changes: 0 additions & 91 deletions Gemfile.lock

This file was deleted.

17 changes: 0 additions & 17 deletions gemfiles/Gemfile.rbx

This file was deleted.

21 changes: 4 additions & 17 deletions lib/tree.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ class TreeNode
include Comparable
include Tree::Utils::TreeMetricsHandler
include Tree::Utils::TreePathHandler
include Tree::Utils::CamelCaseMethodHandler
include Tree::Utils::JSONConverter
include Tree::Utils::TreeMergeHandler
include Tree::Utils::HashConverter
Expand Down Expand Up @@ -217,14 +216,9 @@ def has_children?
# @see #[]
def initialize(name, content = nil)
raise ArgumentError, 'Node name HAS to be provided!' if name == nil
@name, @content = name, content

if name.kind_of?(Integer)
warn StructuredWarnings::StandardWarning,
'Using integer as node name.'\
' Semantics of TreeNode[] may not be what you expect!'\
" #{name} #{content}"
end
name = name.to_s if name.kind_of?(Integer)
@name, @content = name, content

self.set_as_root!
@children_hash = Hash.new
Expand Down Expand Up @@ -593,24 +587,17 @@ def freeze_tree!
# in not in range, or the name is not present, then a +nil+
# is returned.
#
# @note The use of +Integer+ names is allowed by using the optional
# +num_as_name+ flag.
#
# @raise [ArgumentError] Raised if the +name_or_index+ argument is +nil+.
#
# @see #add
# @see #initialize
def [](name_or_index, num_as_name=false)
def [](name_or_index)
raise ArgumentError,
'Name_or_index needs to be provided!' if name_or_index == nil

if name_or_index.kind_of?(Integer) and not num_as_name
if name_or_index.kind_of?(Integer)
@children[name_or_index]
else
if num_as_name and not name_or_index.kind_of?(Integer)
warn StructuredWarnings::StandardWarning,
'Redundant use of the `num_as_name` flag for non-integer node name'
end
@children_hash[name_or_index]
end
end
Expand Down
2 changes: 0 additions & 2 deletions lib/tree/tree_deps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,11 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

require 'structured_warnings'
require 'json'

require_relative '../tree/version'
require_relative '../tree/utils/metrics_methods'
require_relative '../tree/utils/path_methods'
require_relative '../tree/utils/camel_case_method_handler'
require_relative '../tree/utils/json_converter'
require_relative '../tree/utils/tree_merge_handler'
require_relative '../tree/utils/hash_converter'
79 changes: 0 additions & 79 deletions lib/tree/utils/camel_case_method_handler.rb

This file was deleted.

2 changes: 0 additions & 2 deletions lib/tree/utils/hash_converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

require_relative '../../../lib/tree/utils/utils'

module Tree::Utils::HashConverter

def self.included(base)
Expand Down
1 change: 0 additions & 1 deletion lib/tree/utils/json_converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

require_relative '../utils/utils'
require 'json'

# Provides utility methods to convert a {Tree::TreeNode} to and from
Expand Down
Loading