wrapper to path module, to simple require, get and others
HTTP2 client, just with the familiar `https` API
Translates between file formats and generates static code as well as TypeScript definitions.
Binary wrapper that makes your programs seamlessly available as local dependencies
Convert encodings, uses iconv-lite
Binary wrapper that makes your programs seamlessly available as local dependencies
NodeJS OpenSSL wrapper
Output wrapper is a library to write output file to outputpath.
createECDH but browserifiable
Binary wrapper that makes your programs seamlessly available as local dependencies
Highly configurable, well-tested, JavaScript-based HTML minifier.
A wrapper of the webchannel packages from closure-library for use outside of a closure compiled application
A utility library for handling authentication and authorization for redux and react-router
Make a function mimic another one
Get the status of a file with some features
Thin wrapper on top of [this](https://www.npmjs.com/package/xhr-request) to use Promise instead of callbacks.
ES7 async-await wrapper for the csv package.
Promise-based power tool for common filesystem tasks
A toolkit for JavaScript codemods
Integration wrappers for utility libraries
React component for Select2
A JavaScript library for escaping CSS strings and identifiers while generating the shortest possible ASCII-only output.
Callback wrapping utility
Generate ESM wrapper files for CommonJS modules
A wrapper of the critical-path-css-rails gem that handles critical css generation and caching.
A wrapper for Net::HTTP that provides a nicer syntax to download files chunk by chunk and write to a local path.
This gem provides a comprehensive Ruby wrapper around Adobe's native XMP Toolkit (C++ library), enabling applications to easily read, write, and manipulate XMP metadata in various file formats. It handles toolkit initialization, plugin path management for different platforms, and XMP data processing.
It's a thin wrapper of denoland/rust-urlpattern with Magnus. It is useful on the server side when serving different pages based on the URL (a.k.a. routing). It provides pattern matching syntax like /users/:id, similar to route parameters in Express or Path-to-RegExp. You can use it as a foundation to build your own web server or framework.
Defines TG::Geometry with immutable Geom parsing and constructor wrappers, expanded geometry predicates and accessors, Rect helpers, Hex/GeoBIN writers, raw extra_json access, read-only borrowed Line/Ring/Polygon and GeometryCollection child wrappers, value Segment wrappers, Registry reload sugar, optional ActiveRecord source helpers, and an immutable geofencing-oriented Index with owned and borrowed geometry ingestion, flat/rtree strategies, deterministic ordered id results, exact rtree allocation accounting, and native-endian packed point batch queries, and FeatureSource GeoJSON FeatureCollection extraction/build paths over vendored C sources. Ractor support is not claimed.
A simple file-system-based cache wrapper. The main method is 'with_cache( :cache_key=>'something_unique', :timeout_seconds=>(an integer) ){ (...) }' If the given cache key exists and has not timed out, it will return the cached value If not, it will * yield to the given block * store the result of the given block in the cache with the given key * return the result of the given block Required params: * :cache_key=>'some unique string that is valid in a filename' Optional params: * :timeout_seconds => (an integer - default 3600) * :cache_dir => (an absolute path - defaults to RAILS_ROOT/tmp/cache if RAILS_ROOT is defined, otherwise /tmp/cache ) Example usage: @stats_json = Itrigga::Cache::FileCache.with_cache(:cache_key=>'admin_stats.json', :timeout_seconds=>600){ /* some expensive remote API / slow IO call here /* }
google-map-static-image-generator is a Ruby wrapper around the Google Maps Static API that generates PNG map images on the fly — no JavaScript required. Features: - Add custom markers at any coordinates - Draw paths with custom weight and colour - Apply map styles (hide labels, change colours, etc.) - Set center + zoom for marker-free maps - Choose map type: roadmap, satellite, terrain, or hybrid - Default 1024x1024 at scale 2 (retina-friendly) - Raises GoogleMapStaticImage::ApiError on non-200 responses (invalid key, quota exceeded, etc.) Useful for generating map thumbnails in emails, PDFs, admin dashboards, and anywhere an interactive JavaScript map is not practical.
= xattr == DESCRIPTION Xattr provides the xattr (setxattr, getxattr, removexattr, listxattr) functions in a nice object-oriented wrapper. Ruby/DL is used so no compilation of modules is necessary. Extended attributes extend the basic attributes associated with files and directories in the file system. They are stored as name:data pairs associated with file system objects (files, directories, symlinks, etc). == SYNOPSIS Using the library: require "xattr" xattr = Xattr.new("/path/to/file") xattr.list # => [...] xattr.get("...") xattr.set("...", "...") xattr.remove("...") Using the provided command-line tool: $ xattr README.txt com.macromates.caret $ xattr README.txt com.macromates.caret {column = 9; line = 26; } $ xattr README.txt com.macromates.caret "{column = 0; line = 0; }" {column = 0; line = 0; } $ xattr README.txt -com.macromates.caret {column = 0; line = 0; } $ xattr README.txt $ == REQUIREMENTS * Mac OS X 10.4 (for now...) == INSTALL Using rubygems: $ sudo gem install xattr Using setup.rb: $ sudo ruby setup.rb
Miscellaneous methods that may or may not be useful. sh:: Safely pass untrusted parameters to sh scripts. Raise an exception if the script returns a non-zero value. fork_and_check:: Run a block in a forked process and raise an exception if the process returns a non-zero value. do_and_exit, do_and_exit!:: Run a block. If the block does not run exit!, a successful exec or equivalent, run exit(1) or exit!(1) ourselves. Useful to make sure a forked block either runs a successful exec or dies. Any exceptions from the block are printed to standard error. overwrite:: Safely replace a file. Writes to a temporary file and then moves it over the old file. tempname_for:: Generates an unique temporary path based on a filename. The generated filename resides in the same directory as the original one. try_n_times:: Retries a block of code until it succeeds or a maximum number of attempts (default 10) is exceeded. Exception#to_formatted_string:: Return a string that looks like how Ruby would dump an uncaught exception. IO#best_datasync:: Try fdatasync, falling back to fsync, falling back to flush. Random#exp:: Return a random integer 0 ≤ n < 2^argument (using SecureRandom). Random#float:: Return a random float 0.0 ≤ n < argument (using SecureRandom). Random#int:: Return a random integer 0 ≤ n < argument (using SecureRandom). Password:: A small wrapper for String#crypt that does secure salt generation and easy password verification.
Inaba SDBM Manipulator ======================= ## Introduction Inaba SDBM Manipulator is a command line tool to manipulate SDBM database. ## Operation Environment We checked good operation within following environment. - Linux(openSUSE 12.2)・Mac OS X 10.8.2 - Ruby 1.9.3 ## Architectonics - **bin** - **inaba** :: Executable script - **doc** :: Documents generated by rdoc - **lib** - **inaba** - **manipulator.rb** :: Manipulator class - **Rakefile** :: Rakefile that is used to generate gem file - **test** - **tb_manipulator.rb** :: Unit test of Manipulator ## Depended libraries - [Hakto SDBM Safe Wrapper](http://blog.quellencode.org/post/37391766923/ruby-hakto-safe-sdbm-wrapper) - [Ariete STDOUT & STDERR Capture Module](http://blog.quellencode.org/post/37625422082/ariete-stdout-stderr-capture-module) ## Install Download inaba-x.y.z.gem, then execute following command to install Inaba. `$ sudo gem install inaba-x.y.z.gem` On the other hand, you can install from RubyGems.org to use following command. `$ sudo gem install inaba` ## Tutorial ### Configuration of environment variable Set file path of SDBM database to environment variable named $INABA_DB. If target database file is named rabbit.sdb, use following command in bash. `$ export INABA_DB="rabbit.sdb"` ### Add key value pair Use **add** command to add a value to key. `$ inaba add rabbit RABBIT` Use **list** command to show key value pairs. `$ inaba list` [rabbit]:RABBIT Add more pairs. `$ inaba add bunny BUNNY` `$ inaba add hare HARE` `$ inaba list` [rabbit]:RABBIT [bunny]:BUNNY [hare]:HARE Inaba can output a pair list with CSV format. `$ inaba csv` rabbit,RABBIT bunny,BUNNY hare,HARE Also use **keys** command to list keys. `$ inaba keys` rabbit, bunny, hare, **Values** command works listing values. `$ inaba values` RABBIT, BUNNY, HARE, Use **del** command to delete key value command. `$ inaba del rabbit` `$ inaba list` [bunny]:BUNNY [hare]:HARE **Clear** command removes all key value pairs. `$ inaba clear` ## Commands reference |コマンド |引数 |説明 | |----------|-------------|------------------------------------| |**add** |*key* *value*|Add *value* to *key* | |**del** |*key* |Delete a value associated with *key*| |**list** | |Output key value pairs | |**keys** | |Output keys | |**values**| |Output values | |**csv** | |Output pairs with CSV format | |**help** | |Output command list | ## License Inaba is distributed with MIT License. See the LICENSE file to read the detail of license. ## About Author Moza USANE [http://blog.quellencode.org/](http://blog.quellencode.org/ "") mozamimy@quellencode.org
# COM # COM is an object-oriented wrapper around WIN32OLE. COM makes it easy to add behavior to WIN32OLE objects, making them easier to work with from Ruby. ## Usage ## Using COM is rather straightforward. There’s basically four concepts to keep track of: 1. COM objects 2. Instantiable COM objects 3. COM events 4. COM errors Let’s look at each concept separately, using the following example as a base. module Word end class Word::Application < COM::Instantiable def without_interaction with_properties('displayalerts' => Word::WdAlertsNone){ yield } end def documents Word::Documents.new(com.documents) end def quit(saving = Word::WdDoNotSaveChanges, *args) com.quit saving, *args end end ### COM Objects ### A COM::Object is a wrapper around a COM object. It provides error specialization, which is discussed later and a few utility methods. You typically use it to wrap COM objects that are returned by COM methods. If we take the example given in the introduction, Word::Documents is a good candidate: class Word::Documents < COM::Object DefaultOpenOptions = { 'confirmconversions' => false, 'readonly' => true, 'addtorecentfiles' => false, 'visible' => false }.freeze def open(path, options = {}) options = DefaultOpenOptions.merge(options) options['filename'] = Pathname(path).to_com Word::Document.new(com.open(options)) end end Here we override the #open method to be a bit easier to use, providing sane defaults for COM interaction. Worth noting is the use of the #com method to access the actual COM object to invoke the #open method on it. Also note that Word::Document is also a COM::Object. COM::Object provides a convenience method called #with_properties, which is used in the #without_interaction method above. It lets you set properties on the COM::Object during the duration of a block, restoring them after it exits (successfully or with an error). ### Instantiable COM Objects ### Instantiable COM objects are COM objects that we can connect to and that can be created. The Word::Application object can, for example, be created. Instantiable COM objects should inherit from COM::Instantiable. Instantiable COM objects can be told what program ID to use, whether or not to allow connecting to an already running object, and to load its associated constants upon creation. The program ID is used to determine what instantiable COM object to connect to. By default the name of the COM::Instantiable class’ name is used, taking the last two double-colon-separated components and joining them with a dot. For Word::Application, the program ID is “Word.Application”. The program ID can be set by using the .program_id method: class IDontCare::ForConventions < COM::Instantiable program_id 'Word.Application' end The program ID can be accessed with the same method: Word::Application.program_id # ⇒ 'Word.Application' Connecting to an already running COM object is not done by default, but is sometimes desirable: the COM object might take a long time to create, or some common state needs to be accessed. If the default for a certain instantiable COM object should be to connect, this can be done using the .connect method: class Word::Application < COM::Instantiable connect end If no running COM object is available, then a new COM object will be created in its stead. Whether or not a class uses the connection method can be queried with the .connect? method: Word::Application.connect? # ⇒ true Whether or not to load constants associated with an instantiable COM object is set with the .constants method: class Word::Application < COM::Instantiable constants true end and can similarly be checked: Word::Application.constants? # ⇒ true Constants are loaded by default. When an instance of the instantiable COM object is created, a check is run to see if constants should be loaded and whether or not they already have been loaded. If they should be loaded and they haven’t already been loaded, they’re, you guessed it, loaded. The constants are added to the module containing the COM::Instantiable. Thus, for Word::Application, the Word module will contain all the constants. Whether or not the constants have already been loaded can be checked with .constants_loaded?: Word::Application.constants_loaded # ⇒ false That concludes the class-level methods. Let’s begin with the #connected? method among the instance-level methods. This method queries whether or not this instance connected to an already running COM object: Word::Application.new.connected? # ⇒ false This can be very important in determining how shutdown of a COM object should be done. If you connected to an already COM object it might be foolish to shut it down if someone else is using it. The #initialize method takes a couple of options: * connect: whether or not to connect to a running instance * constants: whether or not to load constants These options will, when given, override the class-level defaults. ### Events ### COM events are easily dealt with: class Word::Application < COM::Instantiable def initialize(options = {}) super @events = COM::Events.new(com, 'ApplicationEvents', 'OnQuit') end def quit(saving = Word::WdDoNotSaveChanges, *args) @events.observe('OnQuit', proc{ com.quit saving, *args }) do yield if block_given? end end end To tell you the truth this API sucks and will most likely be rewritten. The reason that it is the way it is is that WIN32OLE, which COM wraps, sucks. It’s event API is horrid and the implementation is buggy. It will keep every registered event block in memory for ever, freeing neither the blocks nor the COM objects that yield the events. ### Errors ### All errors generated by COM methods descend from COM::Error, except for those cases where a Ruby error already exists. The following HRESULT error codes are turned into Ruby errors: HRESULT Error Code | Error Class -------------------|------------ 0x80004001 | NotImplementedError 0x80020005 | TypeError 0x80020006 | NoMethodError 0x8002000e | ArgumentError 0x800401e4 | ArgumentError There are also a couple of other HRESULT error codes that are turned into more specific errors than COM::Error: HRESULT Error Code | Error Class -------------------|------------ 0x80020003 | MemberNotFoundError 0x800401e3 | OperationUnavailableError Finally, when a method results in any other error, a COM::MethodInvocationError will be raised, which can be queried for the specifics, specifically #message, #method, #server, #code, #hresult_code, and #hresult_message. ### Pathname ### The Pathname object receives an additional method, #to_com. This method is useful for when you want to pass a Pathname object to a COM method. Simply call #to_com to turn it into a String of the right encoding for COM: Word::Application.new.documents.open(Pathname('a.docx').to_com) # ⇒ Word::Document ## Installation ## Install COM with % gem install com ## License ## You may use, copy and redistribute this library under the same [terms][1] as Ruby itself. [1]: http://www.ruby-lang.org/en/LICENSE.txt ## Contributors ## * Nikolai Weibull
Diff and patch tables
No description provided.
No description provided.
No description provided.
No description provided.
No description provided.
No description provided.
No description provided.
No description provided.
No description provided.
No description provided.
No description provided.
No description provided.