A quick writeup of architecture ideas for developing and deploying ruby applications.
(NOTE: I'm still semi-new to ruby so I'm mainly compiling untested ideas I hear about).
- Mocking
- Unit Testing
| require 'eventmachine' | |
| require 'aquarium' | |
| class Promise | |
| def null_method(*args) | |
| end | |
| def initialize |
| class ProdOpenstackExternalInterfaceH(logger: ActorRef, xActorSystem: ActorSystem, _httpClient: ActorRef) | |
| extends OpenstackExternalInterfaceH | |
| with HttpHelper with JsonProcessor { | |
| implicit val system = xActorSystem | |
| implicit val httpClient = _httpClient | |
| def parseIpAddress = { json: JValue => | |
| ((json \ "server" \ "addresses" \ "public").filter({ | |
| case JObject(List(JField("version", JInt(x)), JField("addr", JString(_)))) => x == 4 |
| class ProductionDomainNameServiceExternal(logger: ActorRef, xActorSystem: ActorSystem, _httpClient: ActorRef) | |
| extends DomainNameServiceExternal | |
| with HttpHelper with JsonProcessor { | |
| implicit val system = xActorSystem | |
| implicit val httpClient = _httpClient | |
| def with_json(resp: HttpResponse)(callback: JValue => Unit) { | |
| callback(parse(resp.bodyAsString)) | |
| } |
| module AuthenticateBeforeRequests | |
| def self.append_features mod | |
| Aquarium::Aspects::Aspect.new :around, :type => mod, | |
| :methods => [:create_dns_entry,:create_arpa,:exists?,:zone], | |
| :method_options => [:exclude_ancestor_methods] do |jp, object, *args| | |
| object.authenticate | |
| jp.proceed | |
| end | |
| end | |
| end |
By Sheena Artrip
| TODO blog posts. | |
| * Iterative integration development using resque and resque-steps. | |
| * Continue the OSGI webhook blog post. | |
| * Development using octorake. | |
| * Being agile with Java, an opinion post and series of experiments | |
| * Inherited Resources and Versioncake, together. | |
| * Revisiting Jobs: Introduction | |
| * Revisiting Jobs: Electronic Filing. |
| #convert a list of integers into a list of booleans. | |
| 1.9.3p194 :026 > [1,2,3,4].map { |x| x == 3 } => [false, false, true, false] | |
| # return true if any integer is three | |
| 1.9.3p194 :027 > [1,2,3,4].map { |x| x == 3 }.reduce(false,:or) => true | |
| # return true if ALL integers are three | |
| 1.9.3p194 :028 > [1,2,3,4].map { |x| x == 3 }.reduce(true,:and) => false | |
| # return true if ALL integers are three |
| interface GenderModifier { | |
| public void visit(GenderWords words); | |
| } | |
| class PropertiesTranslationGenderModifier implements GenderModifier { | |
| final String prefix; | |
| final Properties properties; | |
| final Locale locale; | |
| public void visit(GenderWords words) { | |
| words.setPossessive(properties.get("genderTranslator." + locale.toString() + "." + prefix + ".possessive")); |