Class: Dedalus::PatternLibrary::LibraryItemExample
- Defined in:
- lib/dedalus/pattern_library/molecules/library_item_example.rb
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#item_class_name ⇒ Object
Returns the value of attribute item_class_name.
-
#item_data ⇒ Object
Returns the value of attribute item_data.
-
#kind ⇒ Object
Returns the value of attribute kind.
-
#name ⇒ Object
Returns the value of attribute name.
Attributes inherited from Element
#height, #height_percent, #margin, #offset, #padding, #position, #shown, #width, #z_order
Class Method Summary collapse
Instance Method Summary collapse
- #background_color ⇒ Object
- #example ⇒ Object
- #item ⇒ Object
- #periodic_table_entry ⇒ Object
- #show ⇒ Object
- #width_percent ⇒ Object
Methods inherited from Molecule
Methods inherited from Element
#big_font, #code_font, #draw_bounding_box, #font, #huge_font, #initialize, #record?, #tiny_font, #view, #window
Constructor Details
This class inherits a constructor from Dedalus::Element
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
8 9 10 |
# File 'lib/dedalus/pattern_library/molecules/library_item_example.rb', line 8 def color @color end |
#item_class_name ⇒ Object
Returns the value of attribute item_class_name.
5 6 7 |
# File 'lib/dedalus/pattern_library/molecules/library_item_example.rb', line 5 def item_class_name @item_class_name end |
#item_data ⇒ Object
Returns the value of attribute item_data.
6 7 8 |
# File 'lib/dedalus/pattern_library/molecules/library_item_example.rb', line 6 def item_data @item_data end |
#kind ⇒ Object
Returns the value of attribute kind.
7 8 9 |
# File 'lib/dedalus/pattern_library/molecules/library_item_example.rb', line 7 def kind @kind end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/dedalus/pattern_library/molecules/library_item_example.rb', line 4 def name @name end |
Class Method Details
.description ⇒ Object
47 48 49 |
# File 'lib/dedalus/pattern_library/molecules/library_item_example.rb', line 47 def self.description "an example of a pattern" end |
.example_data ⇒ Object
51 52 53 54 55 56 57 58 59 60 |
# 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 |
Instance Method Details
#background_color ⇒ Object
43 44 45 |
# File 'lib/dedalus/pattern_library/molecules/library_item_example.rb', line 43 def background_color nil end |
#example ⇒ Object
26 27 28 29 30 31 32 33 |
# 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 ⇒ Object
35 36 37 |
# 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 ⇒ Object
17 18 19 20 21 22 23 24 |
# 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 ⇒ Object
10 11 12 13 14 15 |
# File 'lib/dedalus/pattern_library/molecules/library_item_example.rb', line 10 def show [[ periodic_table_entry, example ]] end |
#width_percent ⇒ Object
39 40 41 |
# File 'lib/dedalus/pattern_library/molecules/library_item_example.rb', line 39 def width_percent 0.6 end |