class Dedalus::PatternLibrary::LibraryItemExample

Attributes

color[RW]
item_class_name[RW]
item_data[RW]
kind[RW]
name[RW]

Public Class Methods

description() click to toggle source
# File lib/dedalus/pattern_library/molecules/library_item_example.rb, line 47
def self.description
  "an example of a pattern"
end
example_data() click to toggle source
# File lib/dedalus/pattern_library/molecules/library_item_example.rb, line 51
def self.example_data
  {
    name: "Huge Text",
    description: "(fake library item molecule)",
    item_class_name: 'Dedalus::PatternLibrary::HugeText',
    item_data: { text: "Hi there!" },
    color: 'red', #Palette.red,
    kind: 'Atom'
  }
end

Public Instance Methods

background_color() click to toggle source
# File lib/dedalus/pattern_library/molecules/library_item_example.rb, line 43
def background_color
  nil
end
example() click to toggle source
# File lib/dedalus/pattern_library/molecules/library_item_example.rb, line 26
def example
  [
    LargeText.new(text: "EXAMPLE", height_percent: 0.05, color: color),
    item,
    LargeText.new(text: "DATA", height_percent: 0.05, color: color),
    Code.new(text: item_data, background_color: Palette.decode_color('darkgray'), padding: 10)
  ]
end
item() click to toggle source
# File lib/dedalus/pattern_library/molecules/library_item_example.rb, line 35
def item
  item_class_name.constantize.new(item_data)
end
periodic_table_entry() click to toggle source
# File lib/dedalus/pattern_library/molecules/library_item_example.rb, line 17
def periodic_table_entry
  PeriodicTableEntry.new(
    element_name: name,
    color: color,
    kind: kind,
    scale: 1.8
  )
end
show() click to toggle source
# File lib/dedalus/pattern_library/molecules/library_item_example.rb, line 10
def show
  [[
    periodic_table_entry,
    example
  ]]
end
width_percent() click to toggle source
# File lib/dedalus/pattern_library/molecules/library_item_example.rb, line 39
def width_percent
  0.6
end