arboretum 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/arboretum/doctree.rb +8 -4
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d56161149a6eda21e434c732c103c4ac08151cbd
4
- data.tar.gz: e539ed1220aa196f007baa50c9bc053230c7b2fc
3
+ metadata.gz: 42a7d24be72182eafaad9b254b40ff5738423389
4
+ data.tar.gz: 5e0fc2574eb3bbc059c94dd9213dd7f7283c35d4
5
5
  SHA512:
6
- metadata.gz: c885a0ba1c59e55cb2cad5375dc8007d5ae8200021a5a105e8e942c34d0829fb2b88c7b4214be04b6bf608a8e040555c2b2d724661c99a9b07c1ccec2255dc8b
7
- data.tar.gz: f03ceac44a40dfdbbdef468792c9780dac288305ceb71b9e23577580d1f71ed3d141a984c38f4889e55b82d400588e4c1733727aeebc655c49db11f64d671cb7
6
+ metadata.gz: 44b8504954777d1d5090fd11cbeba70dcd462d47a117d9b27a1b08de0b491fa74c41062cfa76cfb1e28f709a74779d0c9023ab48922392b61e1fac92ff92a95d
7
+ data.tar.gz: ee812ae2721613864054cd0d605f217bff0495e34021c0e77e2d597ca65b35763024b9f5a5d38c9b2a84fe404a523ec4e25540e3e685a25703949528fc3ef740
@@ -658,13 +658,17 @@ module Arboretum
658
658
 
659
659
  # Add an element to a category in this element's library
660
660
  def lib_add(other, category)
661
- raise TypeError.new("Cannot create a record for a non-element") if !other.is_a?(Element)
661
+ raise TypeError.new("Cannot create a record for a non-element") if !other.is_a?(Element) and !other.is_a?(ElementGroup)
662
662
  if @library.has_key?(category)
663
663
  record = @library[category]
664
- if record.is_a?(Element)
664
+ if record.is_a?(Element) and other.is_a?(Element)
665
665
  @library[category] = ElementGroup.new([record, other])
666
- else record.is_a?(ElementGroup)
667
- record << other
666
+ elsif record.is_a?(ElementGroup) and other.is_a?(Element)
667
+ @library[category] << other
668
+ elsif record.is_a?(Element) and other.is_a?(ElementGroup)
669
+ @library[category] = ElementGroup.new([record]) + other
670
+ elsif record.is_a?(ElementGroup) and other.is_a?(ElementGroup)
671
+ @library[category] = record + other
668
672
  end
669
673
  else
670
674
  @library[category] = other
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arboretum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - tomjw64