summaryrefslogtreecommitdiff
path: root/library.rb
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--library.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/library.rb b/library.rb
new file mode 100644
index 0000000..1fb682b
--- /dev/null
+++ b/library.rb
@@ -0,0 +1,23 @@
1require "./lace"
2
3$smd = "0805"
4
5def r(ohms, footprint=$smd)
6 ohms = ohms.to_s
7 ohms.sub!(/(ohms?|Ω)$/i, "")
8 comp("R", footprint, "resistor", "#{Lace.number(ohms)}Ω")
9end
10
11def c(farads, footprint=$smd)
12 farads = farads.to_s
13 farads.sub!(/f(arads?)?$/i, "")
14 comp("C", footprint, "capacitor", "#{Lace.number(farads)}F")
15end
16
17def d(spec, footprint=$smd)
18 comp("D", footprint, "diode", spec)
19end
20
21def led(spec, ohms, footprint=$smd)
22 comp("D", footprint, "LED", spec) - self.r(ohms, footprint)
23end