Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Processing scraped text #6

Open
nyamadori opened this issue May 10, 2017 · 0 comments
Open

Processing scraped text #6

nyamadori opened this issue May 10, 2017 · 0 comments

Comments

@nyamadori
Copy link
Owner

nyamadori commented May 10, 2017

Proposal

For example when we need to treats comma separated integer, we want to text processing before populating DB (e.g. using ActiveRecord).
So we need text processing methods after data scraping.

class Juknife::Scraper
  scraping do
    item :cost, '#cost'
    items :list, 'ul' do
      item :item1, 'li:nth-of-type(1)'
      item :item2, 'li:nth-of-type(2)'
    end
  end

  process :cost do |text|
    text.delete(',') # something processing to `text`
  end

  process :item1 do |text|
    text.delete(',') # something processing to `text`
  end
  # or 
  process :list, :item1 do |text|
    text.delete(',') # something processing to `text`
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant