class Dedalus::PatternLibrary::PeriodicTable

Attributes

elements[RW]

Public Class Methods

description() click to toggle source
# File lib/dedalus/pattern_library/molecules/periodic_table.rb, line 23
def self.description
  "A collection of elements"
end
example_data() click to toggle source
# File lib/dedalus/pattern_library/molecules/periodic_table.rb, line 27
def self.example_data
  { elements: Array.new(4) { LibraryItemExample.example_data } }
end

Public Instance Methods

element_groups() click to toggle source
# File lib/dedalus/pattern_library/molecules/periodic_table.rb, line 19
def element_groups
  elements.group_by { |elem| elem[:kind] }
end
show() click to toggle source
# File lib/dedalus/pattern_library/molecules/periodic_table.rb, line 6
def show
  self.element_groups.map do |_, grouped_elements|
    grouped_elements.map do |name:, color:, kind:, **|
      PeriodicTableEntry.new(
        element_name: name,
        color: color,
        kind: kind,
        scale: 0.35
      )
    end
  end
end