
Security News
ESLint Adds Support for Parallel Linting, Closing 10-Year-Old Feature Request
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
The sole purpose of this gem is to provide the boilerplate code necessary to import and proces data from files for my applications. This reduces duplication and eases maintenance.
Add this line to your application's Gemfile:
gem 'importeer_plan'
And then execute:
$ bundle
Or install it yourself as:
$ gem install importeer_plan
Importeer.new takes two options:
name (string)
an options-hash
My applications-classes for processing data from external files inherit from Importeer, depending the file-type:
class ImporteerSomething < ImporteerPlan::MyXls
attr_accessor :my_var, :another_var
#call importeer("filename") to import the file in batches of 1000, optional importeer("filename", {size_batch: 1234})
def initialize(*)
super
@my_var = MyVar.all
@another_var = AnotherVar.all
end
end
e = ImporteerPlan::MyXls.new('example.xls')
e.importeer
this works, after you created a file like this:
#save this file as: importeer_example.rb
class ImporteerExample < ImporteerPlan::MyXls
def importeer_batch(batch)
batch.each do |row|
handle_my_model row
end
end
def handle_my_model ref
r=MyModel.new
r.attribute_one = ref[0] unless ref[0].blank?
r.another_attribute = ref[1] unless ref[1].blank?
r.save! if r.attributes.values.any? {|x| !x.blank?}
end
end
Starting 0.3.0, i added some configuration-options. The most basic configuration is setting the path to find the files to import. The default is creating a folder in the 'public' folder, but you could so something like:
ImporteerPlan.configure do |config|
config.dir = Rails.root.join('imports')
end
commaf(string) where string is a dutch amount, separated by ',' turning to a float
pointf(string) where string is a dutch amount, separated by '.' turning to a float
ImporteerPlan uses minitest. Run rake to start the test-suite.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that importeer_plan demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.
Security News
Rspack launches Rslint, a fast TypeScript-first linter built on typescript-go, joining in on the trend of toolchains creating their own linters.