countable_ttps 0.0.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.
- checksums.yaml +7 -0
- data/lib/countable_ttps.rb +30 -0
- metadata +43 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: c152d9babb8070655eb006d50ce00cfd35178a2eb4a8310c7f04f97a6bf3a732
|
|
4
|
+
data.tar.gz: 336a07cd6aae8bd9b13849a4e6976c5e32bdd187e47f8ce72f54d6c5b961129b
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 6a9f9ed3604725fd587bcf2d453babd95ebf81ab8b5d7352e130d58a0e738e2aacbe84d32987f39af65cb9999add83b577dc8784474c44259b4a70532201f878
|
|
7
|
+
data.tar.gz: 5931c6bc03b700dd11a3642e8358617047647c17913eaa8d10bc2fd28dfe1af75be4b9c1a6729a8df9cdfb9026392b48b504075936c8f6f8a89c6ebca780bbe3
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module Countable
|
|
2
|
+
module ClassMethods # mantener este nombre como convención
|
|
3
|
+
def count_invocations_of(method_name)
|
|
4
|
+
# method_name.each do |method| do ## esto podria iterarse por cada metodo con *method_name
|
|
5
|
+
# para pasarle todos los metodos en vez de pasarlos por cada uno
|
|
6
|
+
alias_method "orig_#{method_name}".to_sym, method_name # salva el método que se va a pisar
|
|
7
|
+
|
|
8
|
+
define_method(method_name) do # pisa el método recibido
|
|
9
|
+
invocations_count[method_name] += 1 # incrementa la cantidad de veces que se invoca
|
|
10
|
+
send("orig_#{method_name}".to_sym) # invoca el método original
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.included(base)
|
|
16
|
+
base.extend(ClassMethods)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def invocations_count
|
|
20
|
+
@invocations_count ||= Hash.new(0) ## si no existe se crea el hash con defaults en 0
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def invoked?(method_name)
|
|
24
|
+
invoked(method_name).positive?
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def invoked(method_name)
|
|
28
|
+
invocations_count[method_name]
|
|
29
|
+
end
|
|
30
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: countable_ttps
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Gustavo Lopez
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2023-11-07 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Gemita para la p3 de ttps ruby UNLP
|
|
14
|
+
email: tavo.lop33@gmail.com
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- lib/countable_ttps.rb
|
|
20
|
+
homepage: https://rubygems.org/gems/countable_ttps
|
|
21
|
+
licenses:
|
|
22
|
+
- MIT
|
|
23
|
+
metadata: {}
|
|
24
|
+
post_install_message:
|
|
25
|
+
rdoc_options: []
|
|
26
|
+
require_paths:
|
|
27
|
+
- lib
|
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
34
|
+
requirements:
|
|
35
|
+
- - ">="
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: '0'
|
|
38
|
+
requirements: []
|
|
39
|
+
rubygems_version: 3.4.10
|
|
40
|
+
signing_key:
|
|
41
|
+
specification_version: 4
|
|
42
|
+
summary: si si si
|
|
43
|
+
test_files: []
|