iww 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/CLAUDE.md +84 -0
  3. data/lib/iww/version.rb +2 -1
  4. data/lib/iww.rb +23 -16
  5. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 319681820f002c6ab97a7356942e375d72bb671ffab98f1ab744dc9903cdc190
4
- data.tar.gz: e84777c3a7b8ff07333fbc0d2b48e965996f772a85f16c352cf96bf874fa8c15
3
+ metadata.gz: c9c2b8ec1cece0a321f8229b4cc543959381e3c6604d800b03a88b60ebd9c544
4
+ data.tar.gz: fa50b1a1f2f79e9660dd6d1bbfbbb198a29c7c6f637ab84e682dfdd214f12ad5
5
5
  SHA512:
6
- metadata.gz: b68c3169a0c2cd96011de71e20a055d2d8bf367c68e81006ce57f29dd85a8b5d7c77c20f9583ac06e3281054c1e0b6e4bf6da9abd0ecd9b3736b53e942e9b69a
7
- data.tar.gz: bedc89c475296a45ecf42440fe669718c61bd5afd629d5cf095b98f9fc7b314ba878fc15abfcd8dc3a2c966bdf845ac88f85e5ebabd0a81d46deeae8a54adf2f
6
+ metadata.gz: 250f7a7ff865f1a12f828c74a107d0e65b107672b0ea3afb7718292d2e41448dba9dcd9dd42510120387b84d875b4d60768f8914dc9b2d99a29e4a30ebeda088
7
+ data.tar.gz: 7510914c3123992e9bdc781648bb7b74c38d5a361b9506d5d6533c69a104d8292c1899a83ea6e895806631943e375fad10f87db349f98117294e8ff23b48426c
data/CLAUDE.md ADDED
@@ -0,0 +1,84 @@
1
+ # I.W.W. (iww)
2
+
3
+ Short description
4
+ -----------------
5
+ I.W.W. (iww) is a small Ruby gem that provides convenient access to information and helpers related to the Industrial Workers of the World ("One Big Union"). It exposes a simple API to fetch the preamble, join link, images, job listings, and perform lookup/search of divisions or jobs.
6
+
7
+ Key features
8
+ ------------
9
+ - Access the I.W.W. preamble and join link programmatically
10
+ - Retrieve logos and seal images
11
+ - List jobs and industries represented
12
+ - Lookup divisions, jobs, and perform simple searches
13
+ - Small, dependency-free library with an interactive console for experimentation
14
+
15
+ Installation
16
+ ------------
17
+ Install via Bundler or gem:
18
+
19
+ bundle add iww
20
+
21
+ or
22
+
23
+ gem install iww
24
+
25
+ Usage
26
+ -----
27
+ Require the library and use the top-level Iww API:
28
+
29
+ require 'iww'
30
+
31
+ # get the I.W.W. preamble
32
+ Iww.preamble
33
+
34
+ # open/call the join link (returns URL)
35
+ Iww.join!
36
+
37
+ # fetch images (logos/seal)
38
+ Iww.image
39
+
40
+ # list represented jobs and industries
41
+ Iww.jobs
42
+
43
+ # lookup/search
44
+ Iww[123] # lookup division by number
45
+ Iww['123'] # lookup by string number
46
+ Iww[:job] # lookup by job symbol
47
+ Iww['division'] # lookup by division name
48
+
49
+ Interactive console
50
+ -------------------
51
+ Run the bundled console to experiment with the library:
52
+
53
+ ruby bin/console
54
+
55
+ API overview
56
+ ------------
57
+ - Iww.preamble -> String
58
+ - Iww.join! -> String (URL or link)
59
+ - Iww.image -> Hash or URL(s) for logos/seal
60
+ - Iww.jobs -> Array or Hash of jobs/industries
61
+ - Iww[query] -> Hash mapping division numbers (as strings) to descriptions
62
+
63
+ Examples
64
+ --------
65
+ - Programmatically include the IWW preamble in a website or documentation generator.
66
+ - Build an index of job/industry names for quick lookup in an application.
67
+ - Use Iww[division] to find contact or division descriptions for outreach.
68
+
69
+ Notes
70
+ -----
71
+ - The gem focuses on providing authoritative reference data and simple helpers rather than advanced search features. For richer text search consider combining with a tokenizer or search library.
72
+ - Data and behavior are intentionally straightforward; check the README and source for exact return types in your version.
73
+
74
+ Contributing
75
+ ------------
76
+ Contributions are welcome. Please open issues or PRs; include tests and follow repository guidelines.
77
+
78
+ License
79
+ -------
80
+ This project is licensed under the MIT License. See LICENSE.txt for details.
81
+
82
+ Repository
83
+ ----------
84
+ https://github.com/xorgnak/iww
data/lib/iww/version.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Iww
4
- VERSION = "0.1.0"
4
+ # current version.
5
+ VERSION = "0.1.2"
5
6
  end
data/lib/iww.rb CHANGED
@@ -2,19 +2,22 @@
2
2
 
3
3
  require_relative "iww/version"
4
4
 
5
+ # The Iww Module
5
6
  module Iww
6
- class Error < StandardError; end
7
+ class Error < StandardError; end # :nodoc:
7
8
 
8
9
  @@LOGO = {
9
- white: %[https://www.iww.org/images/globe.svg],
10
- red: %[https://www.iww.org/images/iww-globe-red.svg],
11
- seal: %[https://www.iww.org/images/entitled-iww-logo-white.svg]
10
+ black: %[https://redcard.iww.org/sites/default/files/iww-logo.png],
11
+ white: %[https://www.iww.org/wp-content/uploads/2023/08/globe-2.svg],
12
+ red: %[https://iww.org.uk/app/uploads/Industrial_Workers_of_the_World-white-red.png],
13
+ cat: %[https://i0.wp.com/www.buckeyemuse.com/wp-content/uploads/2020/10/1024px-Anarchist_black_cat.png?ssl=1],
14
+ seal: %[https://www.iww.org/wp-content/uploads/2023/09/entitled-iww-logo-white.svg]
12
15
  }
13
-
16
+ # images
14
17
  def self.image
15
18
  @@LOGO
16
19
  end
17
-
20
+ # sign up link
18
21
  def self.join!
19
22
  %[https://redcard.iww.org/user/register]
20
23
  end
@@ -29,7 +32,7 @@ module Iww
29
32
  %[It is the historic mission of the working class to do away with capitalism. The army of prod uction must be organised, not only for everyday struggle with capitalists, but also to carry on production when capitalism shall have been overthrown. By organizing industrially we are forming the structure of the new society within the shell of the old.],
30
33
  %[Knowing, therefore, that such an organization is absolutely necessary for emancipation, we unite under the following set of guiding principles and rules:]
31
34
  ]
32
-
35
+ # I.W.W. Constitution Preamble.
33
36
  def self.preamble
34
37
  @@OLD
35
38
  end
@@ -74,6 +77,7 @@ module Iww
74
77
  "690" => "Sex Industry"
75
78
  }
76
79
 
80
+ # union divisions
77
81
  def self.divisions
78
82
  @@DIV
79
83
  end
@@ -116,28 +120,31 @@ module Iww
116
120
  "clerk" => ["660"],
117
121
  "budtender" => ["660"]
118
122
  }
119
-
123
+ # List of all jobs and divisions represented.
120
124
  def self.jobs
121
125
  [ @@MAP.keys, @@DIV.values ].flatten
122
126
  end
123
127
 
128
+ # add job +j+ to division +k+.
124
129
  def self.job k, j
125
130
  if !@@MAP.has_key? k.to_s
126
131
  @@MAP[k.to_s] = []
127
132
  end
128
133
  @@MAP[k.to_s] << j
129
134
  end
130
-
135
+
136
+ # job lookup.
131
137
  def self.[] x
132
- if @@MAP.has_key? x.to_s
138
+ xx = x.to_s.downcase
139
+ if @@MAP.has_key? xx
133
140
  o = {}
134
- @@MAP[x.to_s].each { |e| o[e] = @@DIV[e] }
141
+ @@MAP[xx].each { |e| o[e] = @@DIV[e] }
135
142
  return o
136
- elsif @@DIV.has_key? x.to_s
137
- return { x.to_s => @@DIV[x.to_s] }
138
- elsif @@DIV.has_value? x.to_s.capitalize
139
- xx = @@DIV.key(x.to_s.capitalize)
140
- return { xx => x.to_s.capitalize }
143
+ elsif @@DIV.has_key? xx
144
+ return { xx => @@DIV[xx] }
145
+ elsif @@DIV.has_value? xx.to_s.capitalize
146
+ xxx = @@DIV.key(xx.to_s.capitalize)
147
+ return { xxx => xx.to_s.capitalize }
141
148
  else
142
149
  return false
143
150
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iww
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Olson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-18 00:00:00.000000000 Z
11
+ date: 2026-01-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A helpful ruby library to do union division lookups by job, number, or
14
14
  description.
@@ -19,6 +19,7 @@ extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
21
  - CHANGELOG.md
22
+ - CLAUDE.md
22
23
  - CODE_OF_CONDUCT.md
23
24
  - LICENSE.txt
24
25
  - README.md