Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

xmi

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xmi

  • 0.3.11
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= XMI

== Purpose

This Ruby object mapper is a module designed to convert XMI (XML Metadata Interchange) files into Ruby objects. It can also leverage the nokogiri gem for XML parsing and provides methods to dynamically generate Ruby classes and modules based on the XML structure, particularly those related to EA (Enterprise Architect) MDG (Model Driven Generation) extensions.

== Installation

Add this line to your application's Gemfile:

[source,ruby]

gem "xmi"

And then execute:

[source,shell]

$ bundle install

Or install it yourself as:

[source,shell]

$ gem install xmi

== Usage

=== Convert XMI file into Ruby objects

To convert XMI file into Ruby objects, run:

[source,ruby]

xml = "path/to/your/file.xmi" xml_content = File.read(xml) xmi_root_model = Xmi::Sparx::SparxRoot.parse_xml(xml_content)

This method takes the path to an XMI file and generate the Ruby objects.

=== Loading Extensions and Generate Ruby Classes and Modules Dynamically

To load an extension from an XML file, use the load_extension method:

[source,ruby]

Xmi::EaRoot.load_extension("path/to/your/extension.xml")

xml = "path/to/your/file.xmi" xml_content = File.read(xml) xmi_root_model = Xmi::Sparx::SparxRoot.parse_xml(xml_content)

Xmi::EaRoot.load_extension takes the path to an XML file and generate the Ruby classes and modules defined in XML file dynamically. Then, you can generate Ruby objects by Xmi::Sparx::SparxRoot.parse_xml.

=== Output Classes and Modules Generated from Extension into Ruby Files

You can also generate Ruby files directly from the XMI content:

[source,ruby]

Xmi::EaRoot.load_extension( input_xml_path: 'path/to/your/custom_extension.xml', module_name: 'CustomModule' ) Xmi::EaRoot.output_rb_file('path/to/output_file.rb')

This approach allows you to save the dynamically generated Ruby code to a file for further use.

== Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

== Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/xmi. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

== Code of Conduct

Everyone interacting in the Xmi project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

FAQs

Package last updated on 05 Sep 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc