phantom-object 1.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/Gemfile +17 -0
- data/README.rdoc +5 -0
- data/Rakefile +2 -0
- data/lib/hash_converter.rb +5 -0
- data/lib/phantom_object.rb +29 -0
- metadata +51 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5b27cf65e4e9ba559a9a6c79170a28a8e9990a3d
|
4
|
+
data.tar.gz: 9651ded095bcf212d83a7ae0fafc97f4307a7b00
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3fb60cf3ab89972088f8c5d9a1b684a6b21cfb800002d811cf7714877c3f51eeb8adf887973323cba29645cbf44240196978e2ff58f818560abb389e48076c89
|
7
|
+
data.tar.gz: 84a7ab7dd7878834592b8d72b12e19e9368f94a147c9685f6e43a5cc2d0e8db7393615dadb567b26c4150ba559ccc8a6a21ee63522c169404872b5a0fdcef7da
|
data/Gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
# Declare your gem's dependencies in dalli-delete-matched.gemspec.
|
4
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
5
|
+
# development dependencies will be added by default to the :development group.
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
# jquery-rails is used by the dummy application
|
9
|
+
# gem "jquery-rails"
|
10
|
+
|
11
|
+
# Declare any dependencies that are still in development here instead of in
|
12
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
13
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
14
|
+
# your gem to rubygems.org.
|
15
|
+
|
16
|
+
# To use debugger
|
17
|
+
# gem 'debugger'
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
class PhantomObject
|
2
|
+
|
3
|
+
include ActiveModel::Validations
|
4
|
+
include ActiveModel::Conversion
|
5
|
+
include ActiveModel::Serializers
|
6
|
+
extend ActiveModel::Naming
|
7
|
+
|
8
|
+
def initialize args = {}
|
9
|
+
assign_attributes args
|
10
|
+
end
|
11
|
+
|
12
|
+
def assign_attributes args = {}
|
13
|
+
args.each do |key, value|
|
14
|
+
self.class_eval("attr_accessor :#{key}") unless self.respond_to?(key.to_sym)
|
15
|
+
if value.is_a?(Array)
|
16
|
+
self.send("#{key}=", value.map{ |v| self.class.new(v) })
|
17
|
+
elsif value.is_a?(Hash)
|
18
|
+
self.send("#{key}=", self.class.new(value))
|
19
|
+
else
|
20
|
+
self.send("#{key}=", value.is_a?(String) ? value.strip : value)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def persisted?
|
26
|
+
false
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: phantom-object
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kourza Ivan a.k.a. Phobos98
|
8
|
+
autorequire: builder
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-08-30 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A Hash to object converter
|
14
|
+
email: phobos98@phobos98.net
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files:
|
18
|
+
- Gemfile
|
19
|
+
- Rakefile
|
20
|
+
- README.rdoc
|
21
|
+
files:
|
22
|
+
- lib/hash_converter.rb
|
23
|
+
- lib/phantom_object.rb
|
24
|
+
- Gemfile
|
25
|
+
- Rakefile
|
26
|
+
- README.rdoc
|
27
|
+
homepage: https://github.com/Phobos98/phantom-object
|
28
|
+
licenses: []
|
29
|
+
metadata: {}
|
30
|
+
post_install_message:
|
31
|
+
rdoc_options: []
|
32
|
+
require_paths:
|
33
|
+
- lib
|
34
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.3.6
|
44
|
+
requirements: []
|
45
|
+
rubyforge_project: phantom-object
|
46
|
+
rubygems_version: 2.0.3
|
47
|
+
signing_key:
|
48
|
+
specification_version: 4
|
49
|
+
summary: A Hash to object converter
|
50
|
+
test_files: []
|
51
|
+
has_rdoc: false
|