🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

wakizashi

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wakizashi

bundlerRubygems
Version
0.1.1
Version published
Maintainers
1
Created
Source

wakizashi - HTML/XML Parser for RubyMoton

HTML/XML parser for RubyMotion, based on GDataXML-HTML.

Goal: Nokogiri style interface HTML parsing and building for RubyMotion.

Status: basic search, read and write working

Install

Install the gem

gem install wakizashi

Add the gem to your RubyMotion Rakefile

$:.unshift("/Library/RubyMotion/lib")
require 'motion/project'
require 'motion-cocoapods'
require 'wakizashi'

Motion::Project::App.setup do |app|
  app.name = 'myapp'

  # Only needed if you have not already specifying a pods dependency
  app.pods do
    pod 'GDataXML-HTML'
  end
end

Usage

Parsing

Search nodes with XPath

doc = Wakizashi::HTML("<html><body><h1>Hello World</h1><p>Welcome</p><p>Foo</p><a href='http://www.google.com'>Google</a></body></html>")
doc.xpath("//p")

Modify nodes

link = doc.xpath("//a").first
link["href"] # => "http://www.google.com"
link["href"] = "http://wikipedia.org"
link.stringValue = "Wiki"
link.to_html => # "<html><body><h1>Hello World</h1><p>Welcome</p><p>Foo</p><a href='http://wikipedia.org'>Wiki</a></body></html>"

FAQs

Package last updated on 16 Feb 2014

Did you know?

Socket

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.

Install

Related posts