engrade 1.1.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0b4230d6c99403ccd3399d10d1da3d451515a29c
4
- data.tar.gz: a273179b5105e6b7db1debf9994cc836f111b67b
3
+ metadata.gz: 0c1ec0680d76ecf417ed7e627b4aea6afadc3aa8
4
+ data.tar.gz: 1e466ce74f85fc3ce665fa8dc13ab5bc404bde64
5
5
  SHA512:
6
- metadata.gz: b0ff51ce42711db0fbdfb880cfdb44952d78c121f10725252f2bb4228826cb738e8beb6a6b0139ab5eb3e15ff79242cc062215008c12dfd5e534d5dce4c48440
7
- data.tar.gz: a89fcc7983eb26d809f30a25bfe15236469a016306bcc88d9d4d183f9a770fe9583709d60084baa8c17a1825412467f8e21d7a5dfe3c88c08146e75520d34ebc
6
+ metadata.gz: a8d97b4a9ac7cb391c01660c66f0167079a6a1ab4c5a093f4c7e47f98db9a1b0fffd63e4ba8061ddde857258b7bea253b5db8b7e400c0ab0be48c84f98385962
7
+ data.tar.gz: fd9ad6b5653f6a2f71cb19acf3561e357ab47183ab9c72afc61de12ae0ede050c71f0f4eceae8c4f3ae68af730554525fdbd4614ba8dda3149efe8716ed778df
data/lib/engrade.rb CHANGED
@@ -77,7 +77,7 @@ module Engrade
77
77
  # can be filtered by calling with the :only or :except and :type (3=active, 2=archived,
78
78
  # 1=trashed) option.
79
79
  def self.classes(options={})
80
- filter teacher_classes, options
80
+ filter_classes teacher_classes, options
81
81
  end
82
82
 
83
83
 
@@ -87,7 +87,7 @@ module Engrade
87
87
  # assignments can be filtered by calling with the additional :only or :except
88
88
  # option
89
89
  def self.assignments(classes, options={})
90
- filter all_assignments(classes), options
90
+ filter_assignments all_assignments(classes), options
91
91
  end
92
92
 
93
93
 
@@ -109,12 +109,17 @@ module Engrade
109
109
  # HELPER METHODS #
110
110
  ##################
111
111
 
112
- def self.filter(array=[], options={})
113
- var = :name if array.first.instance_of? Classroom
114
- var = :title if array.first.instance_of? Assignment
115
- array.select! { |item| item.send(var).match options[:only]} if options[:only]
116
- array.reject! { |item| item.send(var).match options[:except]} if options[:except]
117
- array.select! { |item| item.folder == options[:type] } if options[:type]
112
+ def self.filter_classes(array=[], options={})
113
+ array.select! { |cl| cl.name.match options[:only]} if options[:only]
114
+ array.reject! { |cl| cl.name.match options[:except]} if options[:except]
115
+ array.select! { |cl| cl.folder == options[:type] } if options[:type]
116
+ array.select! { |cl| cl.syr == options[:syr] } if options[:syr]
117
+ array
118
+ end
119
+
120
+ def self.filter_assignments(array=[], options={})
121
+ array.select! { |assn| assn.title.match options[:only]} if options[:only]
122
+ array.reject! { |assn| assn.title.match options[:except]} if options[:except]
118
123
  array
119
124
  end
120
125
 
@@ -1,3 +1,3 @@
1
1
  module Engrade
2
- VERSION = "1.1.2"
2
+ VERSION = "1.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: engrade
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zachary Thompson