This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def he = new Character { | |
name = "David" | |
hair = dark.as(theNight) + long + messy | |
shoulders = wide.as(aCar) | |
} | |
def excalibur = new Sword(giant, sharp, magical) | |
he.grab(excalibur) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Golondrina | |
def energia=(unaEnergia) | |
@energia = unaEnergia; | |
end | |
def energia | |
@energia | |
end | |
def volar | |
@energia = @energia - 10 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_relative '../src/join_point_metodos' | |
class JoinPointMetodosAccessor < JoinPointMetodos | |
def evaluar(metodo) | |
setter = Proc.new { |nombre| nombre + '=' } | |
getter = Proc.new { |nombre| nombre.delete('=') } | |
if is_setter(metodo.name.to_s) | |
self.esta_el_otro_accessor?(getter,metodo) | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DynamicObject | |
def values | |
@values ||= {} | |
end | |
def method_missing(name,*args) | |
if name.to_s.end_with?('=') | |
self.assign_value(name.to_s[0..-2].to_sym,args[0]) | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def continuity(Character he, Object theNovel) { | |
at(storyTime.minus(aFew.days)) { | |
he { | |
read theNovel | |
putAside what: theNovel becauseOf: (1 to some).collect { | |
new BusinessConference(urgent: true) | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @author: pablitar | |
* Based upon Continuity of the Parks by Julio Cortázar | |
* License: CC BY 4.0 | |
*/ | |
def continuity(Character he, Object theNovel) { | |
at(storyTime.minus(aFew.days)) { | |
he { | |
read theNovel | |
putAside what: theNovel becauseOf: (1 to some).collect { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.util.Random | |
/** | |
* Created by pablitar on 17/05/16. | |
*/ | |
//La aplicación de escritorio sería interesante que fuera una app de scala lisa y llana | |
object PewPewApp extends VainillaApp(new PewPewGame()) | |
//Extender la superclase sería debido a que es probable que haya un ciclo de vida. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def entrenar(tablon: Tablon, criterio: (Equipo,Equipo) => Boolean): Equipo = { | |
def streamMision(equipoActual:Equipo, unTablon: Tablon):Stream[Mision] = { | |
equipoActual.elegirMision(unTablon, criterio) match { | |
case Some(m) => | |
Stream.cons(m, streamMision( | |
m.realizarTareas(equipoActual).get, unTablon.sacarMision(m))) | |
case _ => Stream.empty | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ar.pablitar.random | |
import java.util.Random | |
import java.util.List | |
class RandomExamples { | |
static val random = new Random | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package holascala | |
object ConsolaDeCafe { | |
abstract class ConPrecio { | |
def precio: Double | |
} | |
class Cafe extends ConPrecio { | |
def precio: Double = 10 | |
} |
OlderNewer