practica11 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6e5d7b9aec86cdc27c330085c14c258fd823920d
4
+ data.tar.gz: cc913c515f976fa9b9c8a0d8e1af518863657f3a
5
+ SHA512:
6
+ metadata.gz: 5f46a2f71a770acf2542cfc458ce64ba232b0eb432fa74a926b0268ce8296c9b6f4af6abd5233aaeaaa463d406efd89c91622d9d49d2890d1754ea4db663faa3
7
+ data.tar.gz: 28ad2364d2e57571c9041be11af82429e234c7109d952352d745413d9782b94c8532e2a82816fec4a1144300c6e386278d504da94e94b5cde82998f7bd40cb33
data/.gitignore ADDED
@@ -0,0 +1,20 @@
1
+ ~
2
+ *.o
3
+ *.class
4
+ *.gem
5
+ *.rbc
6
+ .bundle
7
+ .config
8
+ .yardoc
9
+ Gemfile.lock
10
+ InstalledFiles
11
+ _yardoc
12
+ coverage
13
+ doc/
14
+ lib/bundler/man
15
+ pkg
16
+ rdoc
17
+ spec/reports
18
+ test/tmp
19
+ test/version_tmp
20
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in practica11.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 alu0100547139
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # Practica 11
2
+
3
+ #Asignatura
4
+ Lenguajes y paradigmas de la programacion
5
+
6
+ #Alumnos
7
+ Lorenzo Martin Alvarez
8
+ Jorge Gonzalez Gonzalez
9
+
10
+ #Curso
11
+ 2014-2015
data/Rakefile ADDED
@@ -0,0 +1,19 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ task :default => :spec
4
+
5
+ desc "Ejecutar las espectativas de la clase Examen"
6
+ task :spec do
7
+ sh "rspec -I spec/pr11_spec.rb"
8
+ end
9
+
10
+ desc "Ejecutar con documentacion"
11
+ task :doc do
12
+ sh "rspec --format documentation -I. spec/pr11_spec.rb"
13
+ end
14
+
15
+ desc "Ejecutar en html"
16
+ task :html do
17
+ sh "rspec --format html -I. spec/pr11_spec.rb --out report.html"
18
+
19
+ end
@@ -0,0 +1,64 @@
1
+
2
+ class Quiz
3
+ attr_accessor :examen, :preguntas, :respuestas
4
+
5
+
6
+ def initialize(preg, &bloque)
7
+ @examen = preg
8
+ @preguntas = []
9
+ @respuestas = []
10
+ instance_eval &bloque
11
+ end
12
+
13
+ def pregunta(preg , resp = {} )
14
+ @preguntas << preg
15
+ @respuestas.push(resp)
16
+ end
17
+
18
+ def to_s
19
+ salida = "------------------- \n"
20
+ salida << "#{@examen} \n"
21
+ salida << "-------------------\n"
22
+ it = 0
23
+ it1 = 1
24
+ while ( @preguntas[it] != nil)
25
+ salida << "|--- #{@preguntas[it]} ---| \n"
26
+ salida << "#{it1} #{@respuestas[it][:bien]} \n"
27
+ salida << "#{it1+1} #{@respuestas[it][:mal0]}\n"
28
+ salida << "#{it1+2} #{@respuestas[it][:mal1]}\n"
29
+ salida << "#{it1+3} #{@respuestas[it][:mal2]}\n \n"
30
+ it+=1
31
+
32
+ end
33
+
34
+ salida
35
+
36
+ end
37
+
38
+
39
+ #@respuestas[it].each_with_index do | preg,index |
40
+ # salida << "#{index +1 } #{preg[:bien]}"
41
+ # salida << "#{index +1 } #{preg[:mal0]}"
42
+ # salida << "#{index +1 } #{preg[:mal1]}"
43
+ # salida << "#{index +1 } #{preg[:mal2]}"
44
+ #end
45
+
46
+
47
+
48
+
49
+ end
50
+
51
+ quiz = Quiz.new("| Examen de LPP |"){
52
+ pregunta "¿Cuantos argumentos de tipo bloque puede recibir un metodo ?" ,
53
+ :bien => "1.",
54
+ :mal0 => "2.",
55
+ :mal1 => "muchos.",
56
+ :mal2 => "los que defina el usuario."
57
+
58
+ pregunta "¿ En ruby los bloques son objetos que contienen codigo?",
59
+ :bien => "Cierto.",
60
+ :mal0 => "Falso."
61
+
62
+ }
63
+
64
+ puts quiz
@@ -0,0 +1,3 @@
1
+ module Practica11
2
+ VERSION = "0.0.1"
3
+ end
data/lib/practica11.rb ADDED
@@ -0,0 +1,7 @@
1
+ require "practica11/version"
2
+ require "quiz.rb"
3
+
4
+
5
+ module Practica11
6
+ # Your code goes here...
7
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'practica11/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "practica11"
8
+ spec.version = Practica11::VERSION
9
+ spec.authors = ["alu0100547139"]
10
+ spec.email = ["alu0100547139@ull.edu.es"]
11
+ spec.summary = %q{Gema practica 11}
12
+ spec.description = %q{Practica realizada sobre un quiz}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec", "~> 2.11"
24
+ end
data/spec/pr11_spec.rb ADDED
@@ -0,0 +1,29 @@
1
+ require "/home/ubuntu/workspace/LPP1415/practica11/lib/practica11/quiz.rb"
2
+ require 'test/unit'
3
+
4
+ describe Quiz do
5
+
6
+ before :each do
7
+ @quizz= Quiz.new("EXAMEN2"){
8
+ pregunta "Pregunta1", {
9
+ :bien => "0",
10
+ :mal0 => "1",
11
+ :mal1 => "2",
12
+ :mal2 => "3"
13
+ }
14
+ }
15
+ end
16
+
17
+ it " Existe un metodo de la clase Quiz" do
18
+ expect(@quizz.class).to eq(Quiz)
19
+ end
20
+
21
+ it " Existen respuestas" do
22
+ expect(@quizz.examen).not_to eq(nil)
23
+ end
24
+
25
+ it " Existen preguntas "do
26
+ expect(@quizz.preguntas).not_to eq(nil)
27
+ end
28
+
29
+ end
@@ -0,0 +1,17 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+ RSpec.configure do |config|
8
+ config.treat_symbols_as_metadata_keys_with_true_values = true
9
+ config.run_all_when_everything_filtered = true
10
+ config.filter_run :focus
11
+
12
+ # Run specs in random order to surface order dependencies. If you find an
13
+ # order dependency and want to debug it, you can fix the order by providing
14
+ # the seed, which is printed after each run.
15
+ # --seed 1234
16
+ config.order = 'random'
17
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: practica11
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - alu0100547139
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.11'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.11'
55
+ description: Practica realizada sobre un quiz
56
+ email:
57
+ - alu0100547139@ull.edu.es
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - lib/practica11.rb
69
+ - lib/practica11/quiz.rb
70
+ - lib/practica11/version.rb
71
+ - practica11.gemspec
72
+ - spec/pr11_spec.rb
73
+ - spec/spec_helper.rb
74
+ homepage: ''
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.2.2
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: Gema practica 11
98
+ test_files:
99
+ - spec/pr11_spec.rb
100
+ - spec/spec_helper.rb