Skip to content

Commit

Permalink
Merge pull request #2 from mtking2/development
Browse files Browse the repository at this point in the history
Rename method.
  • Loading branch information
mtking2 authored Oct 9, 2019
2 parents a3c737f + df8007e commit 3e4d94c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
# img2zpl

[![gem](https://img.shields.io/gem/v/img2zpl)](https://rubygems.org/gems/img2zpl)

[![downloads](https://img.shields.io/gem/dt/img2zpl?color=brightgreen)](https://rubygems.org/gems/img2zpl)

Ruby library to convert images to usable & printable ZPL code

### Installation

Add the gem to your Gemfile:
```
gem 'img2zpl'
```
And then run `bundle install`

Or install it yourself with:
```
gem install img2zpl
```

### Usage

```ruby
require 'img2zpl'

img = Img2Zpl::Image.open('foo.jpg')
zpl = img.zpl #=> "^FO0,0^GFA, ... ^FS"
zpl = img.to_zpl #=> "^FO0,0^GFA, ... ^FS"
```
2 changes: 1 addition & 1 deletion lib/img2zpl/image.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class Img2Zpl::Image < MiniMagick::Image

def zpl(black_threshold: 0.5)
def to_zpl(black_threshold: 0.5)
bytes_per_row = (width % 8).positive? ? (width / 8) + 1 : (width / 8)
byte_count = bytes_per_row * height
data, line, previous_line, byte = '', '', '', ''
Expand Down
2 changes: 1 addition & 1 deletion lib/img2zpl/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Img2Zpl
VERSION = '0.1.0'
VERSION = '0.1.1'
end
4 changes: 2 additions & 2 deletions spec/img2zpl/image_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
it 'inherits from the MiniMagick::Image class' do
expect(described_class.respond_to?(:open)).to be true
expect(described_class.respond_to?(:read)).to be true
expect(subject.respond_to?(:zpl)).to be true
expect(subject.respond_to?(:to_zpl)).to be true
end

it 'zpl method returns a string' do
expect(subject.zpl).to be_kind_of String
expect(subject.to_zpl).to be_kind_of String
end

end

0 comments on commit 3e4d94c

Please sign in to comment.