Skip to content

Repository files navigation

mruby-os
Build StatusBuild status

Determine system and binary capabilities at runtime.

Installation

Add the line below to your build_config.rb:

MRuby::Build.newdo |conf|
# ... (snip) ...conf.gem'mruby-os'end

Or add this line to your aplication's mrbgem.rake:

MRuby::Gem::Specification.new('your-mrbgem')do |spec|
# ... (snip) ...spec.add_dependency'mruby-logger'end

Usage

To get the machine architecture:

OS.machine# i686 or x86_64

To get the max "word size" of the machine:

OS.bits# 32 or 64# orOS.bits:machine

To get the used "word size" by the binary:

OS.bits:binary

To get the kernel name:

OS.sysname# Darwin, Linux or Windows_NT

To execute code per platform:

ifOS.posix?# The normal wayelse# Windowsend

See also linux?, mac?, macos?, osx?, x?.

Development

Clone the repo:

$ git clone https://github.com/katzer/mruby-os.git && cd mruby-os/

Compile the source:

$ rake compile

Run the tests:

$ rake test

Authors

  • Sebastián Katzer, Fa. appPlant GmbH

License

The gem is available as open source under the terms of the MIT License.

Made with 😋 in Leipzig

© 2017 appPlant GmbH

About

Determine system and binary capabilities at runtime

Topics

Resources

Stars

6 stars

Watchers

6 watching

Forks

Releases

Packages

Contributors

Languages