Module: IcodiCore::Options
- Included in:
- Icodi
- Defined in:
- lib/icodi/options.rb
Instance Method Summary collapse
- #background ⇒ Object
- #color ⇒ Object
- #default_options ⇒ Object
- #density ⇒ Object
- #id ⇒ Object
- #jitter ⇒ Object
- #mirror ⇒ Object
- #mirror_both? ⇒ Boolean
- #mirror_x? ⇒ Boolean
- #mirror_y? ⇒ Boolean
- #pixels ⇒ Object
- #size ⇒ Object
- #stroke ⇒ Object
- #style ⇒ Object
Instance Method Details
#background ⇒ Object
16 17 18 |
# File 'lib/icodi/options.rb', line 16 def background [:background] end |
#color ⇒ Object
20 21 22 |
# File 'lib/icodi/options.rb', line 20 def color [:color] end |
#default_options ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/icodi/options.rb', line 3 def { pixels: 5, density: 0.5, stroke: 0.1, background: '#fff', color: random_color, mirror: :x, jitter: 0, id: :icodi, } end |
#density ⇒ Object
24 25 26 |
# File 'lib/icodi/options.rb', line 24 def density [:density] end |
#id ⇒ Object
28 29 30 |
# File 'lib/icodi/options.rb', line 28 def id [:id] end |
#jitter ⇒ Object
32 33 34 |
# File 'lib/icodi/options.rb', line 32 def jitter [:jitter] end |
#mirror ⇒ Object
36 37 38 |
# File 'lib/icodi/options.rb', line 36 def mirror [:mirror] end |
#mirror_both? ⇒ Boolean
48 49 50 |
# File 'lib/icodi/options.rb', line 48 def mirror_both? mirror == :both end |
#mirror_x? ⇒ Boolean
40 41 42 |
# File 'lib/icodi/options.rb', line 40 def mirror_x? %i[x both].include? mirror end |
#mirror_y? ⇒ Boolean
44 45 46 |
# File 'lib/icodi/options.rb', line 44 def mirror_y? %i[y both].include? mirror end |
#pixels ⇒ Object
52 53 54 |
# File 'lib/icodi/options.rb', line 52 def pixels [:pixels] end |
#size ⇒ Object
56 57 58 |
# File 'lib/icodi/options.rb', line 56 def size @size ||= pixels * 10 end |
#stroke ⇒ Object
60 61 62 |
# File 'lib/icodi/options.rb', line 60 def stroke [:stroke] end |
#style ⇒ Object
64 65 66 |
# File 'lib/icodi/options.rb', line 64 def style @style ||= { stroke: color, stroke_width: stroke } end |