diff options
| author | mattn <[email protected]> | 2013-03-01 15:33:52 +0900 |
|---|---|---|
| committer | mattn <[email protected]> | 2013-03-01 15:33:52 +0900 |
| commit | 3f1814ce3aba08802e0ff73a41cd542ebe9d3def (patch) | |
| tree | 9f26799935b975dcb03627dd5152bff4e86b6e62 /mrblib | |
| parent | 878fe38b4caad6d775072593d9aa3e737926167d (diff) | |
| download | mruby-3f1814ce3aba08802e0ff73a41cd542ebe9d3def.tar.gz mruby-3f1814ce3aba08802e0ff73a41cd542ebe9d3def.zip | |
Move mrblib for Struct
Diffstat (limited to 'mrblib')
| -rw-r--r-- | mrblib/struct.rb | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/mrblib/struct.rb b/mrblib/struct.rb deleted file mode 100644 index 5d0ede90f..000000000 --- a/mrblib/struct.rb +++ /dev/null @@ -1,50 +0,0 @@ -## -# Struct -# -# ISO 15.2.18 - -if Object.const_defined?(:Struct) - class Struct - - ## - # Calls the given block for each element of +self+ - # and pass the respective element. - # - # ISO 15.2.18.4.4 - def each(&block) - self.class.members.each{|field| - block.call(self[field]) - } - self - end - - ## - # Calls the given block for each element of +self+ - # and pass the name and value of the respectiev - # element. - # - # ISO 15.2.18.4.5 - def each_pair(&block) - self.class.members.each{|field| - block.call(field.to_sym, self[field]) - } - self - end - - ## - # Calls the given block for each element of +self+ - # and returns an array with all elements of which - # block is not false. - # - # ISO 15.2.18.4.7 - def select(&block) - ary = [] - self.class.members.each{|field| - val = self[field] - ary.push(val) if block.call(val) - } - ary - end - end -end - |
