Browse Source

adds Behavior >> ownProtocols

Nicolas Petton 11 years ago
parent
commit
729c6f35ee
3 changed files with 44 additions and 0 deletions
  1. 16 0
      js/Kernel-Classes.deploy.js
  2. 21 0
      js/Kernel-Classes.js
  3. 7 0
      st/Kernel-Classes.st

+ 16 - 0
js/Kernel-Classes.deploy.js

@@ -544,6 +544,22 @@ return $1;
 messageSends: ["basicAt:"]}),
 smalltalk.Behavior);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ownProtocols",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._protocols())._reject_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._match_("^\x5c*");
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},smalltalk.Behavior)})},
+messageSends: ["reject:", "match:", "protocols"]}),
+smalltalk.Behavior);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "protocols",

+ 21 - 0
js/Kernel-Classes.js

@@ -710,6 +710,27 @@ referencedClasses: []
 }),
 smalltalk.Behavior);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ownProtocols",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._protocols())._reject_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._match_("^\x5c*");
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},smalltalk.Behavior)})},
+args: [],
+source: "ownProtocols\x0a\x09\x22Answer the protocols of the receiver that are not package extensions\x22\x0a\x0a\x09^ self protocols reject: [ :each |\x0a\x09\x09each match: '^\x5c*' ]",
+messageSends: ["reject:", "match:", "protocols"],
+referencedClasses: []
+}),
+smalltalk.Behavior);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "protocols",

+ 7 - 0
st/Kernel-Classes.st

@@ -143,6 +143,13 @@ organization
 	^ self basicAt: 'organization'
 !
 
+ownProtocols
+	"Answer the protocols of the receiver that are not package extensions"
+
+	^ self protocols reject: [ :each |
+		each match: '^\*' ]
+!
+
 protocols
 	^ self organization elements sorted
 !