pdflib_wrapper 0.0.1 → 0.0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/lib/option_list_mapper.rb +7 -2
 - data/lib/pdflib_wrapper/version.rb +1 -1
 - data/spec/option_list_mapper_spec.rb +3 -1
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: a8f29701c2f544842334b4eca7ac7b6aa056a7bd
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 2df135da682e6d725a46c8d3cdc8d1ef2299448c
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 3c9df8f7b7b1fd66278126097feedff40dd3592eed43a16218546cab145150d7e805edf2c45dffbeb7c07a12d6e235c03ed4520f809b1dc728089ec923a4cff3
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 9cf74bc9d4635dd63a9c62a10e059e163947f6551d59997fe61a754317eb7a26f86dae55e8f98360723753e45175063465ec475b269e3594ad740376a79adeec
         
     | 
    
        data/lib/option_list_mapper.rb
    CHANGED
    
    | 
         @@ -11,13 +11,13 @@ class OptionListMapper 
     | 
|
| 
       11 
11 
     | 
    
         
             
            			OptionListMapper.map_to_string(@modified_options, key, options[key])
         
     | 
| 
       12 
12 
     | 
    
         
             
            			@modified_options << ' '
         
     | 
| 
       13 
13 
     | 
    
         
             
            		end
         
     | 
| 
       14 
     | 
    
         
            -
            		@modified_options << singles.map{|key| options[key]}. 
     | 
| 
      
 14 
     | 
    
         
            +
            		@modified_options << singles.map{|key| OptionListMapper.map_single(key, options[key])}.join(' ')
         
     | 
| 
       15 
15 
     | 
    
         
             
            	end
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
            	class << self
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
            		def create_options(options_list="",kvs=[],singles=[],opts={})
         
     | 
| 
       20 
     | 
    
         
            -
            			new(options_list,kvs,singles,opts).modified_options
         
     | 
| 
      
 20 
     | 
    
         
            +
            			new(options_list,kvs,singles,opts).modified_options.strip
         
     | 
| 
       21 
21 
     | 
    
         
             
            		end
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
            		def map_to_string(string, key, value, display_brackets=true, display_key=true)
         
     | 
| 
         @@ -45,6 +45,11 @@ class OptionListMapper 
     | 
|
| 
       45 
45 
     | 
    
         
             
            			string
         
     | 
| 
       46 
46 
     | 
    
         
             
            		end
         
     | 
| 
       47 
47 
     | 
    
         | 
| 
      
 48 
     | 
    
         
            +
            		def map_single(key, value)
         
     | 
| 
      
 49 
     | 
    
         
            +
            			return '' if value.nil?
         
     | 
| 
      
 50 
     | 
    
         
            +
            			"#{key} #{value}"
         
     | 
| 
      
 51 
     | 
    
         
            +
            		end
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
       48 
53 
     | 
    
         
             
            	end
         
     | 
| 
       49 
54 
     | 
    
         | 
| 
       50 
55 
     | 
    
         
             
            end
         
     | 
| 
         @@ -18,9 +18,11 @@ describe OptionListMapper do 
     | 
|
| 
       18 
18 
     | 
    
         
             
            	end
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
            	it "maps singles and kvs correctly" do
         
     | 
| 
       21 
     | 
    
         
            -
            		opts = {user_password: 'test', master_password: 'testing', permissions: ['nomodify', 'nocopy'], random: ' 
     | 
| 
      
 21 
     | 
    
         
            +
            		opts = {user_password: 'test', master_password: 'testing', permissions: ['nomodify', 'nocopy'], random: 'text'}
         
     | 
| 
       22 
22 
     | 
    
         
             
            		kvs = [:user_password, :master_password, :permissions]
         
     | 
| 
       23 
23 
     | 
    
         
             
            		singles = [:random, :text]
         
     | 
| 
       24 
24 
     | 
    
         
             
            		OptionListMapper.create_options("", kvs,singles,opts).should eq("user_password=test master_password=testing permissions={nomodify nocopy} random text")
         
     | 
| 
       25 
25 
     | 
    
         
             
            	end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
       26 
28 
     | 
    
         
             
            end
         
     |