zitdunyet 0.0.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +6 -0
 - data/lib/zitdunyet/evaluation.rb +10 -1
 - data/lib/zitdunyet/version.rb +1 -1
 - data/spec/lib/zitdunyet/evaluations_spec.rb +35 -0
 - metadata +48 -50
 
    
        data/README.md
    CHANGED
    
    | 
         @@ -104,6 +104,12 @@ Sometimes, though, you may want to be more elaborate in your hinting.  #checkoff 
     | 
|
| 
       104 
104 
     | 
    
         | 
| 
       105 
105 
     | 
    
         
             
            The hint over-rides the label when reported by #hints.
         
     | 
| 
       106 
106 
     | 
    
         | 
| 
      
 107 
     | 
    
         
            +
            #### Checklist
         
     | 
| 
      
 108 
     | 
    
         
            +
             
     | 
| 
      
 109 
     | 
    
         
            +
            They might be a situation where you want a list of both the items that have been completed and the items yet to be done.
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
            + #checklist - returns a hash in which the keys are labels and the values are Boolean (true for complete and false for not complete)
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
       107 
113 
     | 
    
         
             
            ### Advanced Usage
         
     | 
| 
       108 
114 
     | 
    
         | 
| 
       109 
115 
     | 
    
         
             
            Basic usage is fine for most situations, but sometimes you need a little something extra.
         
     | 
    
        data/lib/zitdunyet/evaluation.rb
    CHANGED
    
    | 
         @@ -22,8 +22,11 @@ module Zitdunyet 
     | 
|
| 
       22 
22 
     | 
    
         
             
                  completed_units = 0
         
     | 
| 
       23 
23 
     | 
    
         
             
                  complete = true
         
     | 
| 
       24 
24 
     | 
    
         
             
                  @hints = {}
         
     | 
| 
      
 25 
     | 
    
         
            +
                  @checklist = {}
         
     | 
| 
       25 
26 
     | 
    
         
             
                  self.class.checklist.each do |item|
         
     | 
| 
       26 
     | 
    
         
            -
                     
     | 
| 
      
 27 
     | 
    
         
            +
                    completed = item.logic.call(self)
         
     | 
| 
      
 28 
     | 
    
         
            +
                    @checklist[item.label] = completed
         
     | 
| 
      
 29 
     | 
    
         
            +
                    if completed
         
     | 
| 
       27 
30 
     | 
    
         
             
                      if item.percent
         
     | 
| 
       28 
31 
     | 
    
         
             
                        completed_pct += item.percent
         
     | 
| 
       29 
32 
     | 
    
         
             
                      else
         
     | 
| 
         @@ -50,5 +53,11 @@ module Zitdunyet 
     | 
|
| 
       50 
53 
     | 
    
         
             
                  end
         
     | 
| 
       51 
54 
     | 
    
         
             
                  hints
         
     | 
| 
       52 
55 
     | 
    
         
             
                end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                def checklist
         
     | 
| 
      
 58 
     | 
    
         
            +
                  percent_complete unless @checklist
         
     | 
| 
      
 59 
     | 
    
         
            +
                  @checklist
         
     | 
| 
      
 60 
     | 
    
         
            +
                end
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
       53 
62 
     | 
    
         
             
              end
         
     | 
| 
       54 
63 
     | 
    
         
             
            end
         
     | 
    
        data/lib/zitdunyet/version.rb
    CHANGED
    
    
| 
         @@ -53,6 +53,41 @@ describe "Evaluations" do 
     | 
|
| 
       53 
53 
     | 
    
         
             
                  foo.complete?.should be_true
         
     | 
| 
       54 
54 
     | 
    
         
             
                  foo.percent_complete.should == 100
         
     | 
| 
       55 
55 
     | 
    
         
             
                end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                it "should return a hash of complete and incomplete items" do
         
     | 
| 
      
 58 
     | 
    
         
            +
                  class Foo
         
     | 
| 
      
 59 
     | 
    
         
            +
                    include Zitdunyet::Completeness
         
     | 
| 
      
 60 
     | 
    
         
            +
                    checkoff "Bar", 1.units do |s| s.bar >= 5 end
         
     | 
| 
      
 61 
     | 
    
         
            +
                    checkoff "Baz", 1.units do |s| s.baz >= 5 end
         
     | 
| 
      
 62 
     | 
    
         
            +
                    checkoff "Biz", 1.units do |s| s.biz >= 5 end
         
     | 
| 
      
 63 
     | 
    
         
            +
                    checkoff "Buz", 1.units do |s| s.buz >= 5 end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
                    def bar
         
     | 
| 
      
 66 
     | 
    
         
            +
                      9
         
     | 
| 
      
 67 
     | 
    
         
            +
                    end
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
                    def baz
         
     | 
| 
      
 70 
     | 
    
         
            +
                      3
         
     | 
| 
      
 71 
     | 
    
         
            +
                    end
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
                    def biz
         
     | 
| 
      
 74 
     | 
    
         
            +
                      7
         
     | 
| 
      
 75 
     | 
    
         
            +
                    end
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
                    def buz
         
     | 
| 
      
 78 
     | 
    
         
            +
                      1
         
     | 
| 
      
 79 
     | 
    
         
            +
                    end
         
     | 
| 
      
 80 
     | 
    
         
            +
                  end
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
                  foo = Foo.new
         
     | 
| 
      
 83 
     | 
    
         
            +
                  hash = foo.checklist
         
     | 
| 
      
 84 
     | 
    
         
            +
                  hash['Bar'].should be(true)
         
     | 
| 
      
 85 
     | 
    
         
            +
                  hash['Baz'].should be(false)
         
     | 
| 
      
 86 
     | 
    
         
            +
                  hash['Biz'].should be(true)
         
     | 
| 
      
 87 
     | 
    
         
            +
                  hash['Buz'].should be(false)
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
                end
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
       56 
91 
     | 
    
         
             
              end
         
     | 
| 
       57 
92 
     | 
    
         | 
| 
       58 
93 
     | 
    
         
             
              context "Percentages" do
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,49 +1,55 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            --- !ruby/object:Gem::Specification 
     | 
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: zitdunyet
         
     | 
| 
       3 
     | 
    
         
            -
            version: !ruby/object:Gem::Version 
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.0
         
     | 
| 
       4 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       5 
     | 
    
         
            -
              version: 0.0.2
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
     | 
    
         
            -
            authors: 
     | 
| 
      
 7 
     | 
    
         
            +
            authors:
         
     | 
| 
       8 
8 
     | 
    
         
             
            - David Pellegrini
         
     | 
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2012-08-21 00:00:00.000000000 Z
         
     | 
| 
      
 13 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 14 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
       16 
15 
     | 
    
         
             
              name: rake
         
     | 
| 
       17 
     | 
    
         
            -
              requirement:  
     | 
| 
      
 16 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       18 
17 
     | 
    
         
             
                none: false
         
     | 
| 
       19 
     | 
    
         
            -
                requirements: 
     | 
| 
       20 
     | 
    
         
            -
                - -  
     | 
| 
       21 
     | 
    
         
            -
                  - !ruby/object:Gem::Version 
     | 
| 
       22 
     | 
    
         
            -
                    version:  
     | 
| 
      
 18 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 19 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 20 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 21 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       23 
22 
     | 
    
         
             
              type: :development
         
     | 
| 
       24 
23 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       25 
     | 
    
         
            -
              version_requirements:  
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
      
 24 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 25 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 26 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 27 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 28 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 29 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 30 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
       27 
31 
     | 
    
         
             
              name: rspec
         
     | 
| 
       28 
     | 
    
         
            -
              requirement:  
     | 
| 
      
 32 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       29 
33 
     | 
    
         
             
                none: false
         
     | 
| 
       30 
     | 
    
         
            -
                requirements: 
     | 
| 
       31 
     | 
    
         
            -
                - -  
     | 
| 
       32 
     | 
    
         
            -
                  - !ruby/object:Gem::Version 
     | 
| 
       33 
     | 
    
         
            -
                    version:  
     | 
| 
      
 34 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 35 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 36 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 37 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       34 
38 
     | 
    
         
             
              type: :development
         
     | 
| 
       35 
39 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       36 
     | 
    
         
            -
              version_requirements:  
     | 
| 
      
 40 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 41 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 42 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 43 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 44 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 45 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       37 
46 
     | 
    
         
             
            description: Evaluate how done or complete a process or entity is.
         
     | 
| 
       38 
     | 
    
         
            -
            email: 
     | 
| 
      
 47 
     | 
    
         
            +
            email:
         
     | 
| 
       39 
48 
     | 
    
         
             
            - david.pellegrini@spoke.com
         
     | 
| 
       40 
49 
     | 
    
         
             
            executables: []
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
50 
     | 
    
         
             
            extensions: []
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
51 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
            files: 
         
     | 
| 
      
 52 
     | 
    
         
            +
            files:
         
     | 
| 
       47 
53 
     | 
    
         
             
            - .gitignore
         
     | 
| 
       48 
54 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       49 
55 
     | 
    
         
             
            - LICENSE
         
     | 
| 
         @@ -64,40 +70,32 @@ files: 
     | 
|
| 
       64 
70 
     | 
    
         
             
            - spec/lib/zitdunyet/expressions_spec.rb
         
     | 
| 
       65 
71 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
       66 
72 
     | 
    
         
             
            - zitdunyet.gemspec
         
     | 
| 
       67 
     | 
    
         
            -
            homepage:  
     | 
| 
      
 73 
     | 
    
         
            +
            homepage: ''
         
     | 
| 
       68 
74 
     | 
    
         
             
            licenses: []
         
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
75 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       71 
76 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
            require_paths: 
         
     | 
| 
      
 77 
     | 
    
         
            +
            require_paths:
         
     | 
| 
       74 
78 
     | 
    
         
             
            - lib
         
     | 
| 
       75 
     | 
    
         
            -
            required_ruby_version: !ruby/object:Gem::Requirement 
     | 
| 
      
 79 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       76 
80 
     | 
    
         
             
              none: false
         
     | 
| 
       77 
     | 
    
         
            -
              requirements: 
     | 
| 
       78 
     | 
    
         
            -
              - -  
     | 
| 
       79 
     | 
    
         
            -
                - !ruby/object:Gem::Version 
     | 
| 
       80 
     | 
    
         
            -
                   
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
                  - 0
         
     | 
| 
       83 
     | 
    
         
            -
                  version: "0"
         
     | 
| 
       84 
     | 
    
         
            -
            required_rubygems_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 81 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 82 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 83 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 84 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 85 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       85 
86 
     | 
    
         
             
              none: false
         
     | 
| 
       86 
     | 
    
         
            -
              requirements: 
     | 
| 
       87 
     | 
    
         
            -
              - -  
     | 
| 
       88 
     | 
    
         
            -
                - !ruby/object:Gem::Version 
     | 
| 
       89 
     | 
    
         
            -
                   
     | 
| 
       90 
     | 
    
         
            -
                  segments: 
         
     | 
| 
       91 
     | 
    
         
            -
                  - 0
         
     | 
| 
       92 
     | 
    
         
            -
                  version: "0"
         
     | 
| 
      
 87 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 88 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 89 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 90 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
       93 
91 
     | 
    
         
             
            requirements: []
         
     | 
| 
       94 
     | 
    
         
            -
             
     | 
| 
       95 
92 
     | 
    
         
             
            rubyforge_project: zitdunyet
         
     | 
| 
       96 
     | 
    
         
            -
            rubygems_version: 1.8. 
     | 
| 
      
 93 
     | 
    
         
            +
            rubygems_version: 1.8.23
         
     | 
| 
       97 
94 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       98 
95 
     | 
    
         
             
            specification_version: 3
         
     | 
| 
       99 
     | 
    
         
            -
            summary: DSL to describe the steps to completion and evaluation engine to compute 
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
      
 96 
     | 
    
         
            +
            summary: DSL to describe the steps to completion and evaluation engine to compute
         
     | 
| 
      
 97 
     | 
    
         
            +
              done-ness.
         
     | 
| 
      
 98 
     | 
    
         
            +
            test_files:
         
     | 
| 
       101 
99 
     | 
    
         
             
            - spec/lib/zitdunyet/checkoff_spec.rb
         
     | 
| 
       102 
100 
     | 
    
         
             
            - spec/lib/zitdunyet/class_attr_spec.rb
         
     | 
| 
       103 
101 
     | 
    
         
             
            - spec/lib/zitdunyet/evaluations_spec.rb
         
     |