Skip to content

Commit

Permalink
Merge 1.3 codebase into stable.
Browse files Browse the repository at this point in the history
(resolve merge conflicts)
  • Loading branch information
practicingruby committed Sep 28, 2014
2 parents 815f9ba + 143371d commit a3fc75d
Show file tree
Hide file tree
Showing 47 changed files with 335 additions and 1,024 deletions.
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,5 @@ ClassVars:
Enabled: false
ParameterLists:
Enabled: false
BlockComments:
Enabled: false
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ language: ruby
rvm:
- 1.9.3
- 2.0.0
- 2.1.0
- 2.1.2
- rbx-2
- jruby-19mode
matrix:
Expand Down
7 changes: 3 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ end

desc "Show library's code statistics"
task :stats do
require 'code_statistics'
CodeStatistics::TEST_TYPES << "Specs"
CodeStatistics.new( ["Prawn", "lib"],
["Specs", "spec"] ).to_s
require 'code_statistics/code_statistics'
puts CodeStatistics::CodeStatistics.new( [["Prawn", "lib"],
["Specs", "spec"]] ).to_s
end

YARD::Rake::YardocTask.new do |t|
Expand Down
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

9 changes: 3 additions & 6 deletions lib/prawn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ module Prawn
BASEDIR = File.expand_path(File.join(dir, '..'))
DATADIR = File.expand_path(File.join(dir, '..', 'data'))

VERSION = File.read("#{BASEDIR}/VERSION").strip

FLOAT_PRECISION = 1.0e-9

# Whe set to true, Prawn will verify hash options to ensure only valid keys
Expand Down Expand Up @@ -64,8 +62,9 @@ def configuration(*args)
end
end

require_relative "prawn/errors"
require_relative "prawn/version"

require_relative "prawn/errors"

require_relative "prawn/utilities"
require_relative "prawn/text"
Expand All @@ -84,10 +83,8 @@ def configuration(*args)
require_relative "prawn/repeater"
require_relative "prawn/outline"
require_relative "prawn/grid"

require_relative "prawn/view"
require_relative "prawn/image_handler"



Prawn.image_handler.register(Prawn::Images::PNG)
Prawn.image_handler.register(Prawn::Images::JPG)
35 changes: 8 additions & 27 deletions lib/prawn/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
require_relative "document/column_box"
require_relative "document/internals"
require_relative "document/span"
require_relative "document/graphics_state"

module Prawn

Expand Down Expand Up @@ -53,7 +52,6 @@ class Document
include Prawn::Document::Internals
include PDF::Core::Annotations
include PDF::Core::Destinations
include Prawn::Document::GraphicsState
include Prawn::Document::Security
include Prawn::Text
include Prawn::Graphics
Expand Down Expand Up @@ -202,9 +200,9 @@ def initialize(options={},&block)
self.class.extensions.reverse_each { |e| extend e }
@internal_state = PDF::Core::DocumentState.new(options)
@internal_state.populate_pages_from_store(self)
min_version(state.store.min_version) if state.store.min_version
renderer.min_version(state.store.min_version) if state.store.min_version

min_version(1.6) if options[:print_scaling] == :none
renderer.min_version(1.6) if options[:print_scaling] == :none

@background = options[:background]
@background_scale = options[:background_scale] || 1
Expand Down Expand Up @@ -349,23 +347,13 @@ def float
# Renders the PDF document to string.
# Pass an open file descriptor to render to file.
#
def render(output = StringIO.new)
if output.instance_of?(StringIO)
output.set_encoding(::Encoding::ASCII_8BIT)
end
finalize_all_page_contents

render_header(output)
render_body(output)
render_xref(output)
render_trailer(output)
if output.instance_of?(StringIO)
str = output.string
str.force_encoding(::Encoding::ASCII_8BIT)
return str
else
return nil
def render(*a, &b)
(1..page_count).each do |i|
go_to_page i
repeaters.each { |r| r.run(i) }
end

renderer.render(*a, &b)
end

# Renders the PDF document to file.
Expand Down Expand Up @@ -567,13 +555,6 @@ def number_pages(string, options={})
end
end

# Returns true if content streams will be compressed before rendering,
# false otherwise
#
def compression_enabled?
!!state.compress
end

# @group Experimental API

# Attempts to group the given block vertically within the current context.
Expand Down
73 changes: 0 additions & 73 deletions lib/prawn/document/graphics_state.rb

This file was deleted.

Loading

0 comments on commit a3fc75d

Please sign in to comment.