Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5955719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:09:14+00:00 2026-05-22T18:09:14+00:00

Intro : I’m working on a gem that, by default, will pull information out

  • 0

Intro: I’m working on a gem that, by default, will pull information out of some XML data and do some sort of processing on the document. I’m using nokogiri to parse the XML. However, I wish to allow the user to parse the XML themselves and pass in the necessary information for my data processing methods to run, in case they don’t want to install nokogiri or have already parsed the XML.

Question: Is there any way to allow the user to specify, during gem installation, that they don’t wish to install the nokogiri dependency? For example (very hand-wavey here),

gem install crazy_gem --no-nokogiri

and in the gemspec perhaps something like

Gem::Specification.new do |s|
  ...
  s.add_dependency 'nokogiri' unless Proc.new { install_flags('no-nokogiri') }
  ...
end

[edit] I don’t want to focus too much on the gemspec code above, as I know it doesn’t work–it’s just an example of the kind of thing I want to do. [/edit]

gem install crazy_gem --ignore-dependencies works great until there are additional dependencies.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:09:14+00:00Added an answer on May 22, 2026 at 6:09 pm

    I don’t think you can do exactly what you’re after, but there’s apossible solution if you reframe what your gem does. Rather than a gem that by default parses some XML and processes the data, but optionally allows you to pass in the pre-parsed data, what about a gem that is mainly concerned with the processing, but optionally will parse the XML for you (if you have Nokogiri).

    To do this just leave Nokogiri out of your gemspec dependencies (you could add it as a development dependency or a requirement).

    Inside your code, make sure you only call require 'nokogiri' in a begin..end block with a rescue LoadError and deal with it as appropriate.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently working on a flash project that has an intro video that plays
Intro: I'm working on an image processing task trying to find two borders of
Intro Some continuous-integration tools (say, Hudson) assume compilers generate warnings of different severity (aka
Intro I am doing a kind of OCR application that should recognize characters based
Intro I'm developing a project with MVC.Net. I have just started a default website
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Intro I've used SVN before, back when I was working as a solo programmer,
intro : I spent whole day looking why my processing operation is so so
I have an 'intro' page that I am creating and I want to click
I'm having some trouble. I just discovered that you can control vimeo with js,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.