Sha256: d20eac39b5d3e34f76d37471c33ed53a42ef2ceed0bc304d4fbcd02751091645

Contents?: true

Size: 1.38 KB

Versions: 18

Compression:

Stored size: 1.38 KB

Contents

module Dedalus
  module PatternLibrary
    class LibraryItemExample < Dedalus::Molecule
      attr_accessor :name
      attr_accessor :item_class_name
      attr_accessor :item_data
      attr_accessor :kind
      attr_accessor :color

      def show
        [[
          periodic_table_entry,
          example
        ]]
      end

      def periodic_table_entry
        PeriodicTableEntry.new(
          element_name: name,
          color: color,
          kind: kind,
          scale: 1.8
        )
      end

      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

      def item
        item_class_name.constantize.new(item_data)
      end

      def width_percent
        0.6
      end

      def background_color
        nil
      end

      def self.description
        "an example of a pattern"
      end

      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
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
dedalus-0.2.21 lib/dedalus/pattern_library/molecules/library_item_example.rb
dedalus-0.2.20 lib/dedalus/pattern_library/molecules/library_item_example.rb
dedalus-0.2.19 lib/dedalus/pattern_library/molecules/library_item_example.rb
dedalus-0.2.18 lib/dedalus/pattern_library/molecules/library_item_example.rb
dedalus-0.2.17 lib/dedalus/pattern_library/molecules/library_item_example.rb
dedalus-0.2.16 lib/dedalus/pattern_library/molecules/library_item_example.rb
dedalus-0.2.15 lib/dedalus/pattern_library/molecules/library_item_example.rb
dedalus-0.2.13 lib/dedalus/pattern_library/molecules/library_item_example.rb
dedalus-0.2.12 lib/dedalus/pattern_library/molecules/library_item_example.rb
dedalus-0.2.11 lib/dedalus/pattern_library/molecules/library_item_example.rb
dedalus-0.2.10 lib/dedalus/pattern_library/molecules/library_item_example.rb
dedalus-0.2.9 lib/dedalus/pattern_library/molecules/library_item_example.rb
dedalus-0.2.8 lib/dedalus/pattern_library/molecules/library_item_example.rb
dedalus-0.2.7 lib/dedalus/pattern_library/molecules/library_item_example.rb
dedalus-0.2.6 lib/dedalus/pattern_library/molecules/library_item_example.rb
dedalus-0.2.5 lib/dedalus/pattern_library/molecules/library_item_example.rb
dedalus-0.2.4 lib/dedalus/pattern_library/molecules/library_item_example.rb
dedalus-0.2.3 lib/dedalus/pattern_library/molecules/library_item_example.rb