Module: Sevgi::Graphics::Mixtures::Wrappers::InstanceMethods
- Defined in:
- lib/sevgi/graphics/mixtures/wrappers.rb
Instance Method Summary collapse
- #Cline(x1: 0, y1: 0, x2:, y2:) ⇒ Object
- #cline(x: 0, y: 0, angle:, length:) ⇒ Object
- #css(hash) ⇒ Object
- #cxline(x: 0, y: 0, angle:, dx:) ⇒ Object
- #cyline(x: 0, y: 0, angle:, dy:) ⇒ Object
- #Hline(x1: 0, y1: 0, x2:) ⇒ Object
- #hline(x: 0, y: 0, length:) ⇒ Object
- #square(length:) ⇒ Object
- #Symbol(name, **kwargs, &block) ⇒ Object
- #Symbols(mod, *args, **kwargs) ⇒ Object
- #Vline(x1: 0, y1: 0, y2:) ⇒ Object
- #vline(x: 0, y: 0, length:) ⇒ Object
Instance Method Details
#Cline(x1: 0, y1: 0, x2:, y2:) ⇒ Object
8 9 10 |
# File 'lib/sevgi/graphics/mixtures/wrappers.rb', line 8 def Cline(x1: 0, y1: 0, x2:, y2:, **) path(d: "M #{x1} #{y1} L #{x2} #{y2}", **) end |
#cline(x: 0, y: 0, angle:, length:) ⇒ Object
36 37 38 39 40 |
# File 'lib/sevgi/graphics/mixtures/wrappers.rb', line 36 def cline(x: 0, y: 0, angle:, length:, **) dx = length * ::Math.cos(angle.to_f / 180 * ::Math::PI) dy = length * ::Math.sin(angle.to_f / 180 * ::Math::PI) path(d: "M #{x} #{y} l #{dx} #{dy}", **) end |
#css(hash) ⇒ Object
42 43 44 |
# File 'lib/sevgi/graphics/mixtures/wrappers.rb', line 42 def css(hash, **) style(Content.css(hash), type: "text/css", **) end |
#cxline(x: 0, y: 0, angle:, dx:) ⇒ Object
46 47 48 49 |
# File 'lib/sevgi/graphics/mixtures/wrappers.rb', line 46 def cxline(x: 0, y: 0, angle:, dx:, **) dy = dx * ::Math.tan(angle.to_f / 180 * ::Math::PI) path(d: "M #{x} #{y} l #{dx} #{dy}", **) end |
#cyline(x: 0, y: 0, angle:, dy:) ⇒ Object
51 52 53 54 |
# File 'lib/sevgi/graphics/mixtures/wrappers.rb', line 51 def cyline(x: 0, y: 0, angle:, dy:, **) dx = dy / ::Math.tan(angle.to_f / 180 * ::Math::PI) path(d: "M #{x} #{y} l #{dx} #{dy}", **) end |
#Hline(x1: 0, y1: 0, x2:) ⇒ Object
12 13 14 |
# File 'lib/sevgi/graphics/mixtures/wrappers.rb', line 12 def Hline(x1: 0, y1: 0, x2:, **) path(d: "M #{x1} #{y1} H #{x2}", **) end |
#hline(x: 0, y: 0, length:) ⇒ Object
56 57 58 |
# File 'lib/sevgi/graphics/mixtures/wrappers.rb', line 56 def hline(x: 0, y: 0, length:, **) path(d: "M #{x} #{y} h #{length}", **) end |
#square(length:) ⇒ Object
60 61 62 |
# File 'lib/sevgi/graphics/mixtures/wrappers.rb', line 60 def square(length:, **) rect(width: length, height: length, **) end |
#Symbol(name, **kwargs, &block) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/sevgi/graphics/mixtures/wrappers.rb', line 16 def Symbol(name, **kwargs, &block) id = (words = name.split).map(&:downcase).join("-") title = words.map(&:capitalize).join(" ") symbol(id:, **kwargs) do title(title) Within(&block) end end |
#Symbols(mod, *args, **kwargs) ⇒ Object
26 27 28 29 30 |
# File 'lib/sevgi/graphics/mixtures/wrappers.rb', line 26 def Symbols(mod, *args, **kwargs) CallInside(mod, :defs, :symbol, *args, **kwargs) do |name| title(name.to_s.split("_").map(&:capitalize).join(" ")) end end |
#Vline(x1: 0, y1: 0, y2:) ⇒ Object
32 33 34 |
# File 'lib/sevgi/graphics/mixtures/wrappers.rb', line 32 def Vline(x1: 0, y1: 0, y2:, **) path(d: "M #{x1} #{y1} V #{y2}", **) end |
#vline(x: 0, y: 0, length:) ⇒ Object
64 65 66 |
# File 'lib/sevgi/graphics/mixtures/wrappers.rb', line 64 def vline(x: 0, y: 0, length:, **) path(d: "M #{x} #{y} v #{length}", **) end |