multiarray 0.19.0 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/Rakefile +1 -1
  2. data/lib/multiarray/shortcuts.rb +45 -0
  3. metadata +3 -3
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require 'rake/packagetask'
6
6
  require 'rbconfig'
7
7
 
8
8
  PKG_NAME = 'multiarray'
9
- PKG_VERSION = '0.19.0'
9
+ PKG_VERSION = '0.20.0'
10
10
  RB_FILES = FileList[ 'lib/**/*.rb' ]
11
11
  TC_FILES = FileList[ 'test/tc_*.rb' ]
12
12
  TS_FILES = FileList[ 'test/ts_*.rb' ]
@@ -113,5 +113,50 @@ module Hornetseye
113
113
 
114
114
  Node.class_eval { include MultiArrayConversion }
115
115
 
116
+ # Module with meta-programming methods for creating shortcut methods for reading images
117
+ module ReaderConversion
118
+
119
+ # Meta-programming method for creating shortcut methods for reading images
120
+ #
121
+ # @param [Class] target Element-type to create read method for.
122
+ #
123
+ # @return [Proc] The new method.
124
+ #
125
+ # @private
126
+ def read_shortcut( target )
127
+ define_method( "read_#{target.to_s.downcase}" ) do
128
+ read.to_type target
129
+ end
130
+ end
131
+
132
+ module_function :read_shortcut
133
+
134
+ read_shortcut OBJECT
135
+ read_shortcut BOOL
136
+ read_shortcut BYTE
137
+ read_shortcut UBYTE
138
+ read_shortcut SINT
139
+ read_shortcut USINT
140
+ read_shortcut INT
141
+ read_shortcut UINT
142
+ read_shortcut LONG
143
+ read_shortcut ULONG
144
+ read_shortcut SFLOAT
145
+ read_shortcut DFLOAT
146
+ read_shortcut SCOMPLEX
147
+ read_shortcut DCOMPLEX
148
+ read_shortcut BYTERGB
149
+ read_shortcut UBYTERGB
150
+ read_shortcut SINTRGB
151
+ read_shortcut USINTRGB
152
+ read_shortcut INTRGB
153
+ read_shortcut UINTRGB
154
+ read_shortcut LONGRGB
155
+ read_shortcut ULONGRGB
156
+ read_shortcut SFLOATRGB
157
+ read_shortcut DFLOATRGB
158
+
159
+ end
160
+
116
161
  end
117
162
 
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 19
7
+ - 20
8
8
  - 0
9
- version: 0.19.0
9
+ version: 0.20.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jan Wedekind
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-25 00:00:00 +00:00
17
+ date: 2011-01-26 00:00:00 +00:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency