Permalink
Browse files

Gemified.

  • Loading branch information...
1 parent 0040faa commit 2b506982f55c28fe429ad9b45a556bcac4502b7a @kevinelliott committed Sep 10, 2011
View
@@ -0,0 +1,4 @@
+*.gem
+.bundle
+Gemfile.lock
+pkg/*
View
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+# Specify your gem's dependencies in agent_orange.gemspec
+gemspec
View
@@ -0,0 +1 @@
+require 'bundler/gem_tasks'
View
@@ -0,0 +1,20 @@
+# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+require "agent_orange/version"
+
+Gem::Specification.new do |s|
+ s.name = "agent_orange"
+ s.version = AgentOrange::VERSION
+ s.authors = ["Kevin Elliott"]
+ s.email = ["kevin@welikeinc.com"]
+ s.homepage = "http://github.com/kevinelliott/agent_orange"
+ s.summary = %q{Parse and process User Agents like a secret one}
+ s.description = %q{Parse and process User Agents like a secret one}
+
+ s.rubyforge_project = "agent_orange"
+
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ s.require_paths = ["lib"]
+end
View
@@ -0,0 +1,3 @@
+
+require 'lib/agent_orange'
+user_agent_string = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_5; sv-se) AppleWebKit/525.26.2 (KHTML, like Gecko) Version/3.2 Safari/525.26.12"
View
@@ -0,0 +1,8 @@
+require 'agent_orange/version'
+require 'agent_orange/user_agent'
+require 'agent_orange/device'
+require 'agent_orange/engine'
+require 'agent_orange/browser'
+
+module AgentOrange
+end
View
@@ -1,7 +1,9 @@
-class AgentOrange::Browser
- attr_accessor :name, :version
+module AgentOrange
+ class Browser
+ attr_accessor :name, :version
- def to_s
- "#{self.name} #{self.version}"
+ def to_s
+ "#{self.name} #{self.version}"
+ end
end
end
View
@@ -1,7 +1,9 @@
-class AgentOrange::Device
- attr_accessor :name, :version
+module AgentOrange
+ class Device
+ attr_accessor :name, :version
- def to_s
- "#{name} #{version}"
+ def to_s
+ "#{name} #{version}"
+ end
end
end
View
@@ -1,7 +1,9 @@
-class AgentOrange::Engine
- attr_accessor :name, :version
+module AgentOrange
+ class Engine
+ attr_accessor :name, :version
- def to_s
- "#{name} #{version}"
+ def to_s
+ "#{name} #{version}"
+ end
end
end
@@ -1,28 +1,33 @@
-class AgentOrange::UserAgent
+module AgentOrange
+ class UserAgent
+ attr_accessor :user_agent_string
+ attr_accessor :user_language
+ attr_accessor :device
- attr_accessor :user_agent_string
- attr_accessor :user_language
- attr_accessor :device
-
- def initialize(options = {}, &block)
- @user_agent_string = (options[:user_agent] || options[:ua]).to_s
+ def initialize(options = {}, &block)
+ @user_agent_string = (options[:user_agent] || options[:ua]).to_s
- yield self if block_given?
- end
+ yield self if block_given?
+ end
- def is_computer?
-
- end
+ def is_computer?(type=nil)
+ if type
+ end
+ end
- def is_mobile?
-
- end
+ def is_mobile?(type=nil)
+ if type
+ end
+ end
- def is_bot?
- end
+ def is_bot?(type=nil)
+ if type
+ end
+ end
- def to_s
- "#{device.to_s}"
- end
+ def to_s
+ "#{device.to_s}"
+ end
-end
+ end
+end
@@ -1,4 +1,6 @@
class AgentOrange::Version
+ VERSION = "0.0.1" # This is for the gem and does not conflict with the rest of the functionality
+
attr_accessor :major, :minor, :patch_level, :build_number
def to_s

0 comments on commit 2b50698

Please sign in to comment.