The Problem
Developer (A) creates 2 classes, MyClass and Dependency:
class MyClass
{
private $dependency;
define(['module/bootstrap'], function(news) { | |
var $ = news.$; | |
function seconds(secs) { | |
return secs * 1000; | |
} | |
function double(num) { | |
return num * 2; | |
} |
# - I've assumed you've separated the items into two arrays | |
# because you want to select those items at some point later. | |
# I've refactored to 'filter' the items on the way out, rather | |
# than filtering them on the way in. | |
# - Also added a :type method rather than class checking. | |
# - You could even use Set instead of [] here | |
class Foo | |
def initialize(initial_items = []) | |
@items = initial_items |
// ---------------------------------------- | |
// /path/to/dependency.js | |
define(function() { | |
return { | |
doSomethingWithIt: function() { | |
// blah | |
} | |
}; | |
}); |