mooncats 0.1.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0251649c9c064b96c7c52770bb8245b99d5a67f7885c22a256e41bef7a6e7837'
4
- data.tar.gz: 532761a4f6d3f46c6342c7a527427c9867c228cbc58402d9852bfd63e53f3b6c
3
+ metadata.gz: f488d4e01260236f39d283d0a6913fd6e36f431288e8fb8ffcc2dec6a089f167
4
+ data.tar.gz: 1b6d67ccc3b4f2e887a1c8bf2cc61fa8212753b794ed9dff2f25f9d5b0b3bad6
5
5
  SHA512:
6
- metadata.gz: db123a1e67ad1163dff0c3e9949243ecb24c0869a2aeb9e3e2e289e3c448febbf2b00103ba7f06cde707a0b7048bc004b975463816a6098a97615fa90d5d84e5
7
- data.tar.gz: 57a4f6fae3953ad6fa2a55b1d4bf11ce3755012033acddd4f480c30ec7a41b51c9fe8b2f06f1ece6a8e67ba19fe2591ed7d2273e8cc8b00306f6bcc6d2c95581
6
+ metadata.gz: 57bee5aa14a6958262bd8bd4a32ad94824448b2078545b5be760cafeca5ebfe102aa857b86a8f64623e4b23eed7b054fa2e6aa1a86f51551e1ec80859fde9899
7
+ data.tar.gz: a1c3ca2dc9b14a156d94613b0e07c8f52f41a062d5900f5d0ac9b1b85c75329f99cbaf41d5f39c7de6cfe9679963d06a6172bc4af019a1a5dc5f191f044da639
data/README.md CHANGED
@@ -55,9 +55,9 @@ printing:
55
55
 
56
56
  And voila!
57
57
 
58
- ![](i/mooncat-00000800fa.png)
59
- ![](i/mooncat-0077c8278d.png)
60
- ![](i/mooncat-ff5f000ca7.png)
58
+ ![](https://github.com/cryptocopycats/mooncats/raw/master/i/mooncat-00000800fa.png)
59
+ ![](https://github.com/cryptocopycats/mooncats/raw/master/i/mooncat-0077c8278d.png)
60
+ ![](https://github.com/cryptocopycats/mooncats/raw/master/i/mooncat-ff5f000ca7.png)
61
61
 
62
62
 
63
63
 
@@ -86,23 +86,23 @@ printing:
86
86
 
87
87
  And voila!
88
88
 
89
- ![](i/mooncat-00000800fa_x2.png)
90
- ![](i/mooncat-0077c8278d_x2.png)
91
- ![](i/mooncat-ff5f000ca7_x2.png)
89
+ ![](https://github.com/cryptocopycats/mooncats/raw/master/i/mooncat-00000800fa_x2.png)
90
+ ![](https://github.com/cryptocopycats/mooncats/raw/master/i/mooncat-0077c8278d_x2.png)
91
+ ![](https://github.com/cryptocopycats/mooncats/raw/master/i/mooncat-ff5f000ca7_x2.png)
92
92
 
93
93
 
94
94
  And x4:
95
95
 
96
- ![](i/mooncat-00000800fa_x4.png)
97
- ![](i/mooncat-0077c8278d_x4.png)
98
- ![](i/mooncat-ff5f000ca7_x4.png)
96
+ ![](https://github.com/cryptocopycats/mooncats/raw/master/i/mooncat-00000800fa_x4.png)
97
+ ![](https://github.com/cryptocopycats/mooncats/raw/master/i/mooncat-0077c8278d_x4.png)
98
+ ![](https://github.com/cryptocopycats/mooncats/raw/master/i/mooncat-ff5f000ca7_x4.png)
99
99
 
100
100
 
101
101
  And x8:
102
102
 
103
- ![](i/mooncat-00000800fa_x8.png)
104
- ![](i/mooncat-0077c8278d_x8.png)
105
- ![](i/mooncat-ff5f000ca7_x8.png)
103
+ ![](https://github.com/cryptocopycats/mooncats/raw/master/i/mooncat-00000800fa_x8.png)
104
+ ![](https://github.com/cryptocopycats/mooncats/raw/master/i/mooncat-0077c8278d_x8.png)
105
+ ![](https://github.com/cryptocopycats/mooncats/raw/master/i/mooncat-ff5f000ca7_x8.png)
106
106
 
107
107
 
108
108
 
@@ -31,9 +31,17 @@ module Mooncats
31
31
  ## note: skip all derived column from id e.g.
32
32
  ## - r,g,b, etc.
33
33
 
34
- mint = row['mint'].to_i
35
-
36
- mooncats << Metadata.new( id )
34
+ ## add some more (extra) columns
35
+ mint = row['mint'].to_i
36
+ block = row['block'].to_i
37
+ ## expected timestamp format like
38
+ ## 2017-09-06 15:03:43 UTC
39
+ timestamp = DateTime.strptime( row['timestamp'], '%Y-%m-%d %H:%M:%S %z')
40
+
41
+ mooncats << Metadata.new( id,
42
+ mint: mint,
43
+ block: block,
44
+ timestamp: timestamp )
37
45
  end
38
46
  ## print "\n" ## add progress
39
47
 
@@ -142,7 +142,7 @@ def self.derive_palette( r: nil, g: nil, b: nil,
142
142
  hue = hsl[0]
143
143
  end
144
144
 
145
- hx = hue % 360
145
+ hx = hue % 360 ## note: makes sure number is always POSITIVE (e.g. -13 % 360 => 347)
146
146
  hy = (hue + 320) % 360
147
147
  #=> e.g. hx: 237, hy: 197
148
148
 
@@ -92,26 +92,56 @@ class Metadata
92
92
 
93
93
  def hue
94
94
  @hue ||= begin
95
+ ## note: hsl[0], that is, hue MIGHT BE NEGATIVE!
96
+ ## e.g. try rbg( 91, 27, 41 )
97
+ ## resulting in
98
+ ## hsl( -13, 0.5423728813559322, 0.23137254901960785 )
99
+ ## remember: always use % 360 to make positive!!!
100
+ ## e.g. -13 % 360 => 347
101
+ ## -25 % 360 => 335
95
102
  rgb = ChunkyPNG::Color.rgb( r, g, b )
96
103
  hsl = ChunkyPNG::Color.to_hsl( rgb )
97
- hsl[0]
104
+ hsl[0] % 360 ## make sure number is always POSITIVE!!!
98
105
  end
99
106
  end
100
107
 
108
+
101
109
  def color
110
+ case hue
111
+ when 345..359,
112
+ 0..14 then 'Red'
113
+ when 15..44 then 'Orange'
114
+ when 45..74 then 'Yellow'
115
+ when 75..104 then 'Chartreuse'
116
+ when 105..134 then 'Green'
117
+ when 135..164 then 'Teal'
118
+ when 165..194 then 'Cyan'
119
+ when 195..224 then 'Sky Blue'
120
+ when 225..254 then 'Blue'
121
+ when 255..284 then 'Purple'
122
+ when 285..314 then 'Magenta'
123
+ when 315..344 then 'Fuchsia'
124
+ else
125
+ puts "!! ERROR - unexpected hue (in degress); got #{hue} - expected 0 to 359"
126
+ exit 1
127
+ end
128
+ end
129
+
130
+
131
+ def xxx_color_old_formula ## remove - move to attic??
102
132
  case hue
103
133
  when 0..29 then 'Red'
104
134
  when 30..59 then 'Orange'
105
135
  when 60..89 then 'Yellow'
106
136
  when 90..119 then 'Chartreuse'
107
137
  when 120..149 then 'Green'
108
- when 150..179 then 'Lime Green'
138
+ when 150..179 then 'Lime Green' ## now renamed to Teal
109
139
  when 180..209 then 'Cyan'
110
140
  when 210..239 then 'Sky Blue'
111
141
  when 240..269 then 'Blue'
112
142
  when 270..299 then 'Purple'
113
143
  when 300..329 then 'Magenta'
114
- when 330..359 then 'Fuscia'
144
+ when 330..359 then 'Fuchsia'
115
145
  else
116
146
  puts "!! ERROR - unexpected hue (in degress); got #{hue} - expected 0 to 359"
117
147
  exit 1
@@ -131,7 +161,10 @@ class Metadata
131
161
 
132
162
  ####
133
163
  # more "external" attributes
134
- def mint() @more[:mint]; end
164
+ def mint() @more[:mint]; end
165
+ def block() @more[:block]; end
166
+ def timestamp() @more[:timestamp]; end
167
+ def year() timestamp ? timestamp.year : nil; end
135
168
 
136
169
  #####
137
170
  # enable array-like access to - why? why not?
@@ -153,6 +186,7 @@ class Metadata
153
186
  when :face then face
154
187
  when :fur then fur
155
188
  when :pose then pose
189
+ when :year then year # note: from more via timestamp
156
190
  else
157
191
  @more[ key ]
158
192
  end
@@ -1,9 +1,9 @@
1
1
 
2
2
  module Mooncats
3
3
 
4
- MAJOR = 0
5
- MINOR = 1
6
- PATCH = 3
4
+ MAJOR = 1
5
+ MINOR = 0
6
+ PATCH = 0
7
7
  VERSION = [MAJOR,MINOR,PATCH].join('.')
8
8
 
9
9
  def self.version
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mooncats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-27 00:00:00.000000000 Z
11
+ date: 2021-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chunky_png