package

github.com/werner/crystal_on_steroids

0.12.0 / published Feb 14, 2019 / repository

A group of methods to make Crystal more programmer friendly (extracted from Rails ActiveSupport, Powerpack and others)

Crystal on Steroids Build Status

A group of methods to make Crystal more programmer friendly. Methods taken from Rails ActiveSupport, Powerpack and others.

Api Docs

Installation

Add this to your application's shard.yml:

dependencies:
  crystal_on_steroids:
    github: werner/crystal_on_steroids

Usage

require "crystal_on_steroids"

Methods

AliasMethod

  • alias_method

Object

  • present?
  • presence
  • to_query
  • to_param
  • in?
  • presence_in
  • dig?

Array

  • second
  • third
  • fourth
  • fifth
  • rest
  • not_last
  • dig
  • split
  • from
  • to
  • in_groups
  • slice

Hash

  • compact
  • compact!
  • dig

Enumerable

  • blank?
  • many?
  • pluck
  • excludes?
  • without
  • avg (average)
  • exactly?
  • frecuencies

Time

  • prev_day
  • next_day
  • yesterday
  • tomorrow
  • today?

String

  • remove
  • truncate
  • truncate_words
  • squish

Int

  • multiple_of?
  • ordinal
  • ordinalize

Number

  • bytes
  • kilobytes
  • megabytes
  • gigabytes
  • terabytes
  • petabytes
  • exabytes

Regex

  • match?

Range

  • overlaps?

JSON::Any

  • dig

YAML::Any

  • dig

More details in docs

Contributing

  1. Fork it ( https://github.com/werner/crystal_on_steroids/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • werner Werner Echezuría - creator, maintainer

API

  • AliasMethod
  • Array(T)

    An Array is an ordered, integer-indexed collection of objects of type T.

  • Bool

    Bool has only two possible values: true and false.

  • CrystalOnSteroids
  • Enumerable(T)

    The Enumerable mixin provides collection classes with several traversal, searching, filtering and querying methods.

  • Hash(K, V)

    A Hash represents a collection of key-value mappings, similar to a dictionary.

  • Int

    Int is the base type of all integer types.

  • NamedTuple(**T)

    A named tuple is a fixed-size, immutable, stack-allocated mapping of a fixed set of keys to values.

  • Nil

    The Nil type has only one possible value: nil.

  • Number

    The top-level number type.

  • Object

    Object is the base type of all Crystal objects.

  • Range(B, E)

    A Range represents an interval: a set of values with a beginning and an end.

  • Regex

    A Regex represents a regular expression, a pattern that describes the contents of strings.

  • String

    A String represents an immutable sequence of UTF-8 characters.

  • Time

    Time represents a date-time instant in incremental time observed in a specific time zone.