The state_machines
gem allows you to conditionally define methods based on particular states (i.e. values of an attribute):
class Vehicle
state_machine :alarm_state do
state :active do
def disable_alarm!
end
# Added to support Oracle on Rails 6. | |
# See: https://github.com/rsim/oracle-enhanced/issues/2023 | |
original = ActiveRecord::Relation.instance_method(:delete_all).source | |
unless Digest::MD5.hexdigest(original) == '89a3e7c95873d278263c3d288a6cc242' | |
raise 'Please re-verify oracle_delete_all_shim.rb - method appears to have changed!' | |
end | |
module ActiveRecord |
require 'active_support/all' | |
require 'parquet' # with CentOS7 dependencies as per https://arrow.apache.org/install/ | |
data = { | |
'a_string' => ['hello world'], | |
'an_int' => [1], | |
'a_float' => [1.23], | |
'a_date' => [Date.today], | |
'a_time' => [Time.now.change(usec: 0)] # there's a precision limit... | |
} |
FROM rocker/shiny:4.0.3 | |
ENV RENV_VERSION 0.12.5-2 | |
RUN \ | |
# Ensure shiny-server is run as the shiny user: | |
sed -i 's/exec/exec s6-setuidgid shiny/g' /etc/services.d/shiny-server/run && \ | |
# Remove all the examples: | |
rm -r /srv/shiny-server && \ | |
# Install Renv: |
class Counter | |
attr_reader :thing | |
def initialize(thing) | |
@thing = thing | |
end | |
# The `number` argument's default is an expression that | |
# the will be evaluated in the context of the instance. | |
def print(number: thing.length) |