Il giorno di Natale è stato rilasciato Ruby 2.1.0, il linguaggio creato da Yukihiro Matsumoto.
Come scrive Matz “Ruby is designed to make programmers happy” e noi oggi siamo molto felici!
Altro regalo: è stata rilasciata RC1 di Ruby 2.1.0,
la versione definitiva è prevista per il giorno di Natale!
Potete leggere la presentazione di Koichi Sasada e quella, più datata, di Kostantin Haase
E’ Natale e il regalo di quest’anno è l’anteprima di Ruby On Rails 4.1
Spring velocizza lo sviluppo mantenendo l’applicazione in esecuzione in background, evitando di riavviarla ogni volta che dovete eseguire un task di rake, una migrazione oppure un test.
Questo files, che di default memorizza il parametro secret_key_base dell’applicazione, può essere utilizzato anche per memorizzare le chiavi di accesso per altre API externe.
Per esempio possiamo mantenere l’access key dei web services amazon
development:
secret_key_base: 3b7cd727ee24e8444053437c36cc66c3
aws_access_key
: 09876543212345678
aws_acc_key = Rails.application.secrets.aws_access_key
I request variant sono una specializzazione dei request format
che consentono di effettuare render differenziati in base al dispositivo da cui avviene la richiesta:
respond_to do |format|
format.js { ...... }
format.desktop { ....... }
format.phone { ....... }
format.tablet { ....... }
end
il variant deve essere impostato in una before_action
request.variant =
:tablet
if
request.user_agent =~ /iPad/
Class Invoice < ActiveRecord::Base
enum status: [ :suspended, :active, :payed ]
end
if status.payed? ......………….. prosegue nel prossimo articolo …………..
From Wikipedia, the free encyclopedia
Dynamic programming language is a term used broadly in computer science to describe a class of high-level programming languages that, at runtime, execute many common behaviors that other languages might perform during compilation. These behaviors could include extension of the program, by adding new code, by extending objects and definitions, or by modifying the type system, all during program execution. These behaviors can be emulated in nearly any language of sufficient complexity, but dynamic languages provide direct tools to make use of them. Many of these features were first implemented as native features in the Lisp programming language.
Most dynamic languages are also dynamically typed, but not all are. Dynamic languages can be (but not always) frequently referred to as “scripting languages“, though that article narrowly refers to languages specific to a given environment.