seamus 0.3.3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,6 +8,11 @@ module Seamus
8
8
  super(*args, &block)
9
9
  # create_methods_for inspector
10
10
  end
11
+
12
+ def inspection_attributes
13
+ @inspection_attributes ||= [] + standard_attributes
14
+ end
15
+
11
16
  end
12
17
  end
13
18
  end
@@ -6,8 +6,13 @@ module Seamus
6
6
  include Seamus::StandardAdditions
7
7
  def initialize(*args, &block)
8
8
  super(*args, &block)
9
- create_methods_for inspector, :except => "path"
9
+ create_methods_for inspector, :except => [:filename, :path, :full_filename, :raw_response, :raw_metadata, :ffmpeg_binary, :ffmpeg_binary=]
10
10
  end
11
+
12
+ def inspection_attributes
13
+ @inspection_attributes ||= [:valid?, :invalid?, :unknown_format?, :unreadable_file?, :audio?, :video?, :container, :raw_duration, :duration, :bitrate, :bitrate_units, :audio_bit_rate, :audio_stream, :audio_codec, :audio_sample_rate, :audio_sample_units, :audio_channels_string, :audio_channels, :audio_stream_id, :video_stream, :video_stream_id, :video_codec, :video_colorspace, :width, :height, :resolution, :fps] + standard_attributes
14
+ end
15
+
11
16
  end
12
17
  end
13
18
  end
@@ -8,6 +8,11 @@ module Seamus
8
8
  super(*args, &block)
9
9
  create_methods_for inspector, :except => ["thumbnail", "thumbnail2"]
10
10
  end
11
+
12
+ def inspection_attributes
13
+ @inspection_attributes ||= [:width, :height] + standard_attributes
14
+ end
15
+
11
16
  end
12
17
  end
13
18
  end
@@ -9,5 +9,10 @@ module Seamus
9
9
  # create_methods_for inspector
10
10
  end
11
11
  end
12
+
13
+ def inspection_attributes
14
+ @inspection_attributes ||= [:words, :word_count, :lines, :line_count] + standard_attributes
15
+ end
16
+
12
17
  end
13
18
  end
@@ -6,8 +6,13 @@ module Seamus
6
6
  include Seamus::StandardAdditions
7
7
  def initialize(*args, &block)
8
8
  super(*args, &block)
9
- create_methods_for inspector, :except => "path"
9
+ create_methods_for inspector, :except => [:filename, :path, :full_filename, :raw_response, :raw_metadata, :ffmpeg_binary, :ffmpeg_binary=]
10
10
  end
11
+
12
+ def inspection_attributes
13
+ @inspection_attributes ||= [:valid?, :invalid?, :unknown_format?, :unreadable_file?, :audio?, :video?, :container, :raw_duration, :duration, :bitrate, :bitrate_units, :audio_bit_rate, :audio_stream, :audio_codec, :audio_sample_rate, :audio_sample_units, :audio_channels_string, :audio_channels, :audio_stream_id, :video_stream, :video_stream_id, :video_codec, :video_colorspace, :width, :height, :resolution, :fps] + standard_attributes
14
+ end
15
+
11
16
  end
12
17
  end
13
18
  end
@@ -22,6 +22,23 @@ module Seamus
22
22
  MimeTable.lookup_by_extension(extension).to_s
23
23
  end
24
24
 
25
+ def add_inspection_attributes(*args)
26
+ args.select{|arg| arg.respond_to?(:to_sym) }.each do |arg|
27
+ inspection_attributes.push arg
28
+ end
29
+ end
30
+
31
+ def [](attribute)
32
+ attributes[attribute.to_sym]
33
+ end
34
+
35
+ def attributes
36
+ @attributes ||= inspection_attributes.inject({}) do |h, i|
37
+ h[i] = self.send(i) if self.respond_to?(i)
38
+ h
39
+ end
40
+ end
41
+
25
42
  private
26
43
 
27
44
  def create_method(method, method_binding)
@@ -29,11 +46,15 @@ module Seamus
29
46
  end
30
47
 
31
48
  def create_methods_for(object, options={})
32
- options[:except] = options[:except].to_a unless options[:except].is_a?(Array)
49
+ options[:except] = [options[:except]] unless options[:except].is_a?(Array)
33
50
  object.public_methods(false).each do |method|
34
51
  create_method(method, lambda {object.method(method.to_s).call}) unless options[:except].include?(method)
35
52
  end
36
53
  end
54
+
55
+ def standard_attributes
56
+ [:size, :md5]
57
+ end
37
58
 
38
59
  # def method_missing(method, *args, &block)
39
60
  # if file_attributes.has_key?(method.to_s)
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{seamus}
8
- s.version = "0.3.3"
8
+ s.version = "0.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Scott Burton"]
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seamus
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
5
- prerelease:
4
+ prerelease: false
6
5
  segments:
7
6
  - 0
8
- - 3
9
- - 3
10
- version: 0.3.3
7
+ - 4
8
+ - 0
9
+ version: 0.4.0
11
10
  platform: ruby
12
11
  authors:
13
12
  - Scott Burton
@@ -26,7 +25,6 @@ dependencies:
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- hash: 3
30
28
  segments:
31
29
  - 0
32
30
  version: "0"
@@ -40,7 +38,6 @@ dependencies:
40
38
  requirements:
41
39
  - - ">="
42
40
  - !ruby/object:Gem::Version
43
- hash: 3
44
41
  segments:
45
42
  - 0
46
43
  version: "0"
@@ -111,7 +108,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
111
108
  requirements:
112
109
  - - ">="
113
110
  - !ruby/object:Gem::Version
114
- hash: 3
115
111
  segments:
116
112
  - 0
117
113
  version: "0"
@@ -120,14 +116,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
116
  requirements:
121
117
  - - ">="
122
118
  - !ruby/object:Gem::Version
123
- hash: 3
124
119
  segments:
125
120
  - 0
126
121
  version: "0"
127
122
  requirements: []
128
123
 
129
124
  rubyforge_project:
130
- rubygems_version: 1.4.2
125
+ rubygems_version: 1.3.7
131
126
  signing_key:
132
127
  specification_version: 3
133
128
  summary: Seamus is not an Irish monk