Skip to content

Commit

Permalink
:hidden option simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdalilue committed Jul 21, 2021
1 parent 0fb2b56 commit 901a728
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/prawn/embedded_files.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def file(src, options = {})
filespec = Filespec.new(file_obj, options)
filespec_obj = filespec.build_pdf_object(self)

unless filespec.hidden
unless filespec.hidden?
# Wait for pdf-core PR

# attach_file(filespec.file_name, filespec_obj)
Expand Down
11 changes: 4 additions & 7 deletions lib/prawn/embedded_files/filespec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Prawn
module EmbeddedFiles
class Filespec
attr_reader :file_name, :not_hidden
attr_reader :file_name

def initialize(file, options = {})
name = options[:name] || file.chksum
Expand All @@ -15,15 +15,12 @@ def initialize(file, options = {})
@description = PDF::Core::LiteralString.new(desc_str)
end

if options[:hidden].nil? || options[:hidden] != true
@not_hidden = true
end

@hidden = !options[:hidden].nil? && options[:hidden] == true
@file = file
end

def hidden
!@not_hidden
def hidden?
@hidden
end

def build_pdf_object(document)
Expand Down

0 comments on commit 901a728

Please sign in to comment.