Sha256: f01a12ec6ee31e9da10fe0b044d6e1768d24b7aea9e4790e55ced35cb6873896
Contents?: true
Size: 979 Bytes
Versions: 8
Compression:
Stored size: 979 Bytes
Contents
require 'summary_judgement' module BrighterPlanet module Flight module Summarization def self.included(base) base.extend SummaryJudgement base.summarize do |has| has.adjective 'one-way', :if => lambda { |flight| flight.trips == 1 } has.adjective 'round-trip', :if => lambda { |flight| flight.trips == 1 } has.adjective 'nonstop', :if => lambda { |flight| flight.emplanements_per_trip == 1 } has.identity 'flight' has.modifier lambda { |flight| "from #{flight.origin_airport.name}" }, :if => :origin_airport has.modifier lambda { |flight| "to #{flight.destination_airport.name}" }, :if => :destination_airport has.modifier lambda { |flight| "on a #{flight.vehicle}" }, :if => :vehicle has.modifier lambda { |flight| "on #{flight.date.to_formatted_s(:archive)}"}, :if => :date has.verb :take has.aspect :perfect end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems