New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

raes

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

raes

  • 0.2.4
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Raes

Raes is Rails Async Event Store. Executes a class method call asynchronously. Others use Rails' Active Job and Active Storage services to store files.

  • Raes (※)

rice

Usage

Dispatch a class name that has a call method.

Simple Echo

Same echo call method.

class SimpleEcho
  include Raes::UseCaller

  def initialize(params)
    @params = params
  end

  def call
    @params
  end
end

When executed, { message:'Hi' } is saved in state.

Raes.dispatch(SimpleEcho, { message: 'Hi' })
Raes.search(SimpleEcho).last.state # "{\"message\":\"Hi\"}"

File Maker

Rewrite old file newly.

class FileMaker
  include Raes::UseCaller
  include Raes::UseStorage

  def initialize(params)
    @raes_storage_id = params[:raes_storage_id]
  end

  def call
    old_file = raes_storage_content
    new_file = old_file + 'bar'

    raes_storage_attach({ io: StringIO.new(new_file), filename: 'new_file.txt', content_type: 'text/plain' })
  end
end

Content will be changed to the new file.

Raes.dispatch(FileMaker, raes_storage: { io: StringIO.new('foo'), filename: 'old_file.txt', content_type: 'text/plain' })
Raes.search(FileMaker).last.storages.first.content.download # foobar

Installation

Add this line to your application's Gemfile:

gem 'raes'

And then execute:

$ bundle
$ rails raes:install:migrations

If use storage, then execute:

$ rails active_storage:install

Configuration

Add the following to your config/raes.yml:

default: &default
  concern:
    context_logger: Rails

development:
  <<: *default

test:
  <<: *default

production:
  <<: *default

Test

$ rails app:spec

License

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

FAQs

Package last updated on 28 Dec 2020

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