rubyxls 1.0.1 → 1.0.2
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/README.md +38 -18
 - data/lib/rubyxls/version.rb +1 -1
 - data/rubyxls.gemspec +2 -1
 - metadata +5 -6
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: eb3630d44053544b4a5943ee6f3ffb26e21bddae
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 89bb16cdd9d467525549d901937aa3747b1c3d11
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 26a1793e58dbb39221afd293339a1eb0b59b1a5e226347b878448492c3f6c21d8ac03a62f3b73f79ef57db40197aed12de95bd4a69067e62452b0880edfff6e6
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 6782d5f75f510bee6af778b092bcb9753ab1aa5e8c6e47481760e9b17e0d37596ba2657b7ae983a0afb89cf718bb529ddf37b02cc195cfa1c478e9f357f1cd5f
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,8 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            [](https://circleci.com/gh/viewthespace/rubyxls) [](https://codeclimate.com/repos/576ddc37553f02006c008f07/feed)
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       1 
3 
     | 
    
         
             
            # Rubyxls
         
     | 
| 
       2 
4 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            Generate XLS files using ruby. Rubyxls provides a simple DSL  
     | 
| 
      
 5 
     | 
    
         
            +
            Generate XLS files using ruby. Rubyxls provides a simple DSL to express anything from simple ruby strings to complex Active Record models.
         
     | 
| 
       4 
6 
     | 
    
         
             
            Support for multi-sheet workbooks, chart generation, and formula based cells included.
         
     | 
| 
       5 
7 
     | 
    
         | 
| 
      
 8 
     | 
    
         
            +
            **This would not have been possible without the hard work of the Axlsx team. Thanks for creating the foundation
         
     | 
| 
      
 9 
     | 
    
         
            +
            that Rubyxls is built on top of! Please be sure to check out their repo here: https://github.com/randym/axlsx.**
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
       6 
11 
     | 
    
         
             
            ## Installation
         
     | 
| 
       7 
12 
     | 
    
         | 
| 
       8 
13 
     | 
    
         
             
            Add this line to your application's Gemfile:
         
     | 
| 
         @@ -55,8 +60,8 @@ class YourVeryOwnReport < Rubyxls::Report 
     | 
|
| 
       55 
60 
     | 
    
         
             
              end
         
     | 
| 
       56 
61 
     | 
    
         
             
            end
         
     | 
| 
       57 
62 
     | 
    
         
             
            ```
         
     | 
| 
       58 
     | 
    
         
            -
            - ** 
     | 
| 
       59 
     | 
    
         
            -
            - **Call super() in  
     | 
| 
      
 63 
     | 
    
         
            +
            - **Extend `Rubyxls::Report`** - this will give you all the functionality a report needs to build itself.
         
     | 
| 
      
 64 
     | 
    
         
            +
            - **Call `super()` in `#initialize`** - this will create an instance variable `@workbooks` to hold all of the beautfiul workbooks you are about to create!
         
     | 
| 
       60 
65 
     | 
    
         
             
            - **#build_workbooks!** - append any workbooks that you create into `@workbooks` so that your report "has_many" workbooks just like the real excel!
         
     | 
| 
       61 
66 
     | 
    
         | 
| 
       62 
67 
     | 
    
         
             
            #### Workbook
         
     | 
| 
         @@ -76,8 +81,8 @@ class YourVeryOwnWorkbook < Rubyxls::Workbook 
     | 
|
| 
       76 
81 
     | 
    
         | 
| 
       77 
82 
     | 
    
         
             
            end
         
     | 
| 
       78 
83 
     | 
    
         
             
            ```
         
     | 
| 
       79 
     | 
    
         
            -
            - ** 
     | 
| 
       80 
     | 
    
         
            -
            - **Call super() in  
     | 
| 
      
 84 
     | 
    
         
            +
            - **Extend `Rubyxls::Workbook`** - get all of that groovy (not the programming language) functionality that Rubyxls gives your Workbook.
         
     | 
| 
      
 85 
     | 
    
         
            +
            - **Call `super()` in `#initialize` passing in a "`name`" parameter** - this will create an instance variable `@sheets` to hold all of your sheets and will name the workbook you are creating.
         
     | 
| 
       81 
86 
     | 
    
         
             
            - **#build_sheets!** - append any sheets that you create into `@sheets` so that your workbook "has_many" sheets!
         
     | 
| 
       82 
87 
     | 
    
         | 
| 
       83 
88 
     | 
    
         
             
            #### Sheet
         
     | 
| 
         @@ -98,8 +103,8 @@ class YourVeryOwnSheet < Rubyxls::Sheet 
     | 
|
| 
       98 
103 
     | 
    
         | 
| 
       99 
104 
     | 
    
         
             
            end
         
     | 
| 
       100 
105 
     | 
    
         
             
            ```
         
     | 
| 
       101 
     | 
    
         
            -
            - ** 
     | 
| 
       102 
     | 
    
         
            -
            - **Call super() in  
     | 
| 
      
 106 
     | 
    
         
            +
            - **Extend `Rubyxls::Sheet`** - gotta get that sheet functionality
         
     | 
| 
      
 107 
     | 
    
         
            +
            - **Call `super()` in `#initialize` passing in a "`name`" parameter** - this will give your sheet a name
         
     | 
| 
       103 
108 
     | 
    
         
             
            - **#build_cells!** - this is the dumping ground for all of your data. The CellBuilder, which takes in a view model as a parameter will break apart your view models / tables into invidual
         
     | 
| 
       104 
109 
     | 
    
         
             
            cells and organize them properly. Don't forget to specify where on the sheet you would like your view models to be drawn using `start_row` and `start_column`!
         
     | 
| 
       105 
110 
     | 
    
         
             
            Behind the scenes, we are taking all of your modularized view models, breaking them apart into individual cells, throwing all of those cells into one LARGE pot and re-arranging them in the
         
     | 
| 
         @@ -111,7 +116,7 @@ class YourVeryOwnViewModel < Rubyxls::ViewModel 
     | 
|
| 
       111 
116 
     | 
    
         | 
| 
       112 
117 
     | 
    
         
             
              def initialize(whatever_data_you_need)
         
     | 
| 
       113 
118 
     | 
    
         
             
                @data = whatever_data_you_need
         
     | 
| 
       114 
     | 
    
         
            -
                super() 
     | 
| 
      
 119 
     | 
    
         
            +
                super() # Call #super passing in no parameters
         
     | 
| 
       115 
120 
     | 
    
         
             
              end
         
     | 
| 
       116 
121 
     | 
    
         | 
| 
       117 
122 
     | 
    
         
             
              private
         
     | 
| 
         @@ -124,9 +129,9 @@ class YourVeryOwnViewModel < Rubyxls::ViewModel 
     | 
|
| 
       124 
129 
     | 
    
         | 
| 
       125 
130 
     | 
    
         
             
            end
         
     | 
| 
       126 
131 
     | 
    
         
             
            ```
         
     | 
| 
       127 
     | 
    
         
            -
            - ** 
     | 
| 
       128 
     | 
    
         
            -
            - **Call super() in  
     | 
| 
       129 
     | 
    
         
            -
            -  
     | 
| 
      
 132 
     | 
    
         
            +
            - **Extend `Rubyxls::ViewModel`**
         
     | 
| 
      
 133 
     | 
    
         
            +
            - **Call `super()` in `#initialize`**
         
     | 
| 
      
 134 
     | 
    
         
            +
            - **`#build_data_rows!`** - this is where you decide what data goes into the workbook and how it looks. Let's break it down by describing the ruby version of each excel component that makes up a row.
         
     | 
| 
       130 
135 
     | 
    
         
             
              ```
         
     | 
| 
       131 
136 
     | 
    
         
             
              | Ruby  | Excel | Desciption                                             |
         
     | 
| 
       132 
137 
     | 
    
         
             
              | -----  -------  ------------------------------------------------------ |
         
     | 
| 
         @@ -143,6 +148,21 @@ end 
     | 
|
| 
       143 
148 
     | 
    
         
             
              ```
         
     | 
| 
       144 
149 
     | 
    
         
             
              A list of default styles is provided below!
         
     | 
| 
       145 
150 
     | 
    
         | 
| 
      
 151 
     | 
    
         
            +
             
     | 
| 
      
 152 
     | 
    
         
            +
            #### Generating a report file
         
     | 
| 
      
 153 
     | 
    
         
            +
             
     | 
| 
      
 154 
     | 
    
         
            +
              Once a `Report` object and all of its associated components are initialized, generating an output file is straightforward.
         
     | 
| 
      
 155 
     | 
    
         
            +
             
     | 
| 
      
 156 
     | 
    
         
            +
              `Rubyxls::Report#download!` returns an IO stream that can be written to a file.
         
     | 
| 
      
 157 
     | 
    
         
            +
             
     | 
| 
      
 158 
     | 
    
         
            +
              If a `Report` has more than one workbook, the generated output file will be a `zip` file (containing multiple spreadsheets) instead of an `xslx` (Excel) file. The `#file_extension` method will return the expected file extension for the file.
         
     | 
| 
      
 159 
     | 
    
         
            +
             
     | 
| 
      
 160 
     | 
    
         
            +
            ````ruby
         
     | 
| 
      
 161 
     | 
    
         
            +
            File.open("myfile.#{my_report.file_extension}", 'w') do |f|
         
     | 
| 
      
 162 
     | 
    
         
            +
              f << report.download!.read
         
     | 
| 
      
 163 
     | 
    
         
            +
            end
         
     | 
| 
      
 164 
     | 
    
         
            +
            ````
         
     | 
| 
      
 165 
     | 
    
         
            +
             
     | 
| 
       146 
166 
     | 
    
         
             
            ### Styling
         
     | 
| 
       147 
167 
     | 
    
         
             
            #### Default Styles
         
     | 
| 
       148 
168 
     | 
    
         
             
            - :bold
         
     | 
| 
         @@ -157,10 +177,10 @@ end 
     | 
|
| 
       157 
177 
     | 
    
         
             
            - :bottom_align
         
     | 
| 
       158 
178 
     | 
    
         
             
            - :middle_align
         
     | 
| 
       159 
179 
     | 
    
         
             
            - :border_right
         
     | 
| 
       160 
     | 
    
         
            -
            - : 
     | 
| 
       161 
     | 
    
         
            -
            - : 
     | 
| 
       162 
     | 
    
         
            -
            - : 
     | 
| 
       163 
     | 
    
         
            -
            - : 
     | 
| 
      
 180 
     | 
    
         
            +
            - :border_left
         
     | 
| 
      
 181 
     | 
    
         
            +
            - :border_top
         
     | 
| 
      
 182 
     | 
    
         
            +
            - :border_bottom
         
     | 
| 
      
 183 
     | 
    
         
            +
            - :border_all
         
     | 
| 
       164 
184 
     | 
    
         
             
            - :number
         
     | 
| 
       165 
185 
     | 
    
         
             
            - :decimal
         
     | 
| 
       166 
186 
     | 
    
         
             
            - :date
         
     | 
| 
         @@ -191,8 +211,8 @@ class YourVeryOwnCustomStyleManager < Rubyxls::StyleManager 
     | 
|
| 
       191 
211 
     | 
    
         | 
| 
       192 
212 
     | 
    
         
             
            end
         
     | 
| 
       193 
213 
     | 
    
         
             
            ```
         
     | 
| 
       194 
     | 
    
         
            -
            - ** 
     | 
| 
       195 
     | 
    
         
            -
            - **Call super in  
     | 
| 
      
 214 
     | 
    
         
            +
            - **Extend `Rubyxls::StyleManager`**
         
     | 
| 
      
 215 
     | 
    
         
            +
            - **Call `super` in `#initialize`** - in order to get all of those default styles that Rubyxls provides.
         
     | 
| 
       196 
216 
     | 
    
         
             
            - **#initialize_base_styles!** - define your own styles according the the excel specification. Each style only needs a set of attributes.
         
     | 
| 
       197 
217 
     | 
    
         | 
| 
       198 
218 
     | 
    
         
             
            Now you can apply your newly defined styles inside of any sheet.
         
     | 
| 
         @@ -218,7 +238,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To 
     | 
|
| 
       218 
238 
     | 
    
         | 
| 
       219 
239 
     | 
    
         
             
            ## Contributing
         
     | 
| 
       220 
240 
     | 
    
         | 
| 
       221 
     | 
    
         
            -
            Bug reports and pull requests are welcome on GitHub at https://github.com/ 
     | 
| 
      
 241 
     | 
    
         
            +
            Bug reports and pull requests are welcome on GitHub at https://github.com/viewthespace/rubyxls. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
         
     | 
| 
       222 
242 
     | 
    
         | 
| 
       223 
243 
     | 
    
         | 
| 
       224 
244 
     | 
    
         
             
            ## License
         
     | 
    
        data/lib/rubyxls/version.rb
    CHANGED
    
    
    
        data/rubyxls.gemspec
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: rubyxls
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.2
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Alexander Frankel
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2017-03-22 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -58,14 +58,14 @@ dependencies: 
     | 
|
| 
       58 
58 
     | 
    
         
             
                requirements:
         
     | 
| 
       59 
59 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       60 
60 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       61 
     | 
    
         
            -
                    version: 2.0 
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '2.0'
         
     | 
| 
       62 
62 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       63 
63 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       64 
64 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       65 
65 
     | 
    
         
             
                requirements:
         
     | 
| 
       66 
66 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       67 
67 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       68 
     | 
    
         
            -
                    version: 2.0 
     | 
| 
      
 68 
     | 
    
         
            +
                    version: '2.0'
         
     | 
| 
       69 
69 
     | 
    
         
             
            description: |-
         
     | 
| 
       70 
70 
     | 
    
         
             
              Generate XLS files using ruby. Rubyxls provides a simple DSL to
         
     | 
| 
       71 
71 
     | 
    
         
             
                                        express anything from simple ruby strings to complex Active Record models.
         
     | 
| 
         @@ -120,9 +120,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       120 
120 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       121 
121 
     | 
    
         
             
            requirements: []
         
     | 
| 
       122 
122 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       123 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 123 
     | 
    
         
            +
            rubygems_version: 2.5.2
         
     | 
| 
       124 
124 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       125 
125 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       126 
126 
     | 
    
         
             
            summary: A simple DSL for generating XLS files in plain-old ruby.
         
     | 
| 
       127 
127 
     | 
    
         
             
            test_files: []
         
     | 
| 
       128 
     | 
    
         
            -
            has_rdoc: 
         
     |