Class: Rbmnist::ImageWrapper
- Inherits:
-
Object
- Object
- Rbmnist::ImageWrapper
- Defined in:
- lib/rbmnist/image_wrapper.rb
Constant Summary collapse
- WIDTH =
28- HEIGHT =
28
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #[](arg) ⇒ Object
- #[]=(val, newval) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(data) ⇒ ImageWrapper
constructor
A new instance of ImageWrapper.
- #map(&block) ⇒ Object
- #pixels ⇒ Object
- #to_a ⇒ Object
- #to_a_2d ⇒ Object
- #to_png ⇒ Object
Constructor Details
#initialize(data) ⇒ ImageWrapper
Returns a new instance of ImageWrapper.
8 9 10 |
# File 'lib/rbmnist/image_wrapper.rb', line 8 def initialize(data) @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/rbmnist/image_wrapper.rb', line 6 def data @data end |
Instance Method Details
#[](arg) ⇒ Object
20 21 22 |
# File 'lib/rbmnist/image_wrapper.rb', line 20 def [](arg) @data[arg] end |
#[]=(val, newval) ⇒ Object
24 25 26 |
# File 'lib/rbmnist/image_wrapper.rb', line 24 def []=(val, newval) @data[val] = newval end |
#each(&block) ⇒ Object
28 29 30 |
# File 'lib/rbmnist/image_wrapper.rb', line 28 def each(&block) @data.each(&block) end |
#map(&block) ⇒ Object
32 33 34 |
# File 'lib/rbmnist/image_wrapper.rb', line 32 def map(&block) @data.map(&block) end |
#pixels ⇒ Object
12 13 14 |
# File 'lib/rbmnist/image_wrapper.rb', line 12 def pixels @data end |
#to_a ⇒ Object
16 17 18 |
# File 'lib/rbmnist/image_wrapper.rb', line 16 def to_a return data end |