Skip to content


Subversion checkout URL

You can clone with
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: solnic/virtus
base: v0.0.4
head fork: solnic/virtus
compare: v0.0.6
Commits on Jul 08, 2011
@dkubb dkubb Split up Virtus.determine_type 07badb1
@dkubb dkubb Adjusted flay threshold a59e31e
@dkubb dkubb Minor documentation fix a85b1fb
@dkubb dkubb Factored out primitive/string type lookup to Attribute 880a097
@dkubb dkubb Moved Virtus.determine_type to Virtus::Attribute.determine_type
* Everything the determine_type depends on is an Attribute concern, so I moved
  it to the class that contains the responsibility of modelling Attributes.
* Made other Attribute.determine_type_* methods private since they are just
  helper methods and are not intended to be used in isolation.
@dkubb dkubb Clean up Attribute.determine_type with a case statement 14cc31d
@dkubb dkubb Removed unnecessary configuration from Rakefile
* It is unclear to me why these are necessary, so removing for now. Perhaps
  @solnic can comment on what their purpose is. I suspect that many of these
  are now deprecated from rubygems configuration anyway.
@dkubb dkubb Minor tweak to Rakefile to make it more consistent with coding conven…
@dkubb dkubb Add json as a dependency because of how AS depends on it :( 243790b
@dkubb dkubb Add backports as a development dependency
* This may be somewhat controversial, because it means that Virtus is
  targeting the 1.9 core/stdlib. This is inline with future plans for
  DataMapper, Veritas and supporting libs. I'm adding this as a separate
  commit so it can be discussed and possibly rolled back if it's wrong
@dkubb dkubb Simplified Attribute.determine_type case statement with Class#singlet…

* This method is part of the 1.9 core API, and is only available in 1.8
  because backports is a development dependency.
@dkubb dkubb Removed redundant comments
* In general the reason for factoring out complex logic into named methods is
  to remove the need for comments like this. If the method is well named then
  the command is completely redundant.
@dkubb dkubb Add the private_class_method declaration after the method 48e7244
@dkubb dkubb Updated Attribute class methods to be command methods 8e68a2a
@dkubb dkubb Renamed Attribute#concat_options to Attribute#add_accepted_options 6ff8f5b
@dkubb dkubb Updated class_eval comments to match DM conventions 191c0a8
@dkubb dkubb Regenerated gemspec d92d399
@dkubb dkubb Bumped version to 0.0.5 0340111
@dkubb dkubb Specify return value as undefined if it should not be relied upon d654aa7
@dkubb dkubb Removed unnecessary method call b7972d0
@dkubb dkubb Changed semipublic to public
* No point in having the semipublic/public distinction.
@dkubb dkubb Use the special YARD type "Boolean" instead of [TrueClass, FalseClass] 73221af
@dkubb dkubb Minor formatting fixes for code comments c1cb306
@dkubb dkubb Minor documentation update e4cea92
@dkubb dkubb Updated Attribute methods to be command methods 1a1da35
@dkubb dkubb Updated Typecast class methods to be private
* The private keyword does not do anything for class methods, this uses
  private_class_method for that.
* Added missing documentation to Typecast class methods
* Instead of testing that something is a kind of Hash, use the #to_hash
  protocol to coerce it. If it is not hash-like then it won't support
  it, giving the same outcome as the original code, but with support for
  Mash and other similar object types.
* Removed redundant comments for @param and @return values
@dkubb dkubb Added History.txt stub for 0.0.5 changes b7aa842
@dkubb dkubb Added summary of 0.0.5 changes so far 7a75db9
@dkubb dkubb Adjusted flay and roodi thresholds c2201f6
@dkubb dkubb Use "descendant" in #included hook methods cb04911
Commits on Jul 09, 2011
@dkubb dkubb Simplified true/false lookup tables
* A simpler approach is just to take the downcased, string representation of
  the boolean-like value and map it to either true or false.
Commits on Jul 10, 2011
@dkubb dkubb Added DescendantsTracker#add_descendant
* Instead of calling inherited explicitly, call a method that explicitly
  adds the descendants. This avoids some of the problems where a class like
  Object might have .descendants monkey-patched in. It also allows the
  inherited hook to be private, which it is in Object.

Fixes #14
@solnic Adjusted flay threshold cda410d
@solnic Regenerate gemspec for version 0.0.5 54c194b
Commits on Jul 13, 2011
@dkubb dkubb Regenerated gemspec 1f853e5
@dkubb dkubb Renamed methods that create other methods to match ruby conventions 95c7d0d
@dkubb dkubb Make sure class/module hook methods are private to match superclass v…
@dkubb dkubb Make sure the descendant tracker is setup inside the class method ext…
@dkubb dkubb Make sure the hook method is properly commented 7317949
@dkubb dkubb Make sure hook methods always call super 366f091
@dkubb dkubb Adjusted flay and roodi thresholds 923c999
@dkubb dkubb Documentation fix dae39c6
@dkubb dkubb Minor documentation fix 03b0c11
@dkubb dkubb Renamed class method to match ruby conventions 94042b0
@dkubb dkubb Adjusted reek threshold 6bb1249
@dkubb dkubb Adjusted roodi thresholds 71bae65
@dkubb dkubb Use closures for reader/writer methods
* Simplified generated reader/writer methods
* This saves having to do the lookup on the AttributeSet at runtime and
  should give better performance than other approaches. Plus this eliminates
  some work because Attribute#get checks the ivars anyway.
* Moved AttributeMethod mixin so it happens in Virtus::ClassMethods#attribute
Commits on Jul 14, 2011
@solnic Adjust flay threshold eda5af2
@solnic Rename and to to_s and to_boolean …
…to match naming conventions
@solnic Add @example sections to Attribute docs e9c3660
@solnic Removed #typecast_to_primitive
If someone wants to mutate a value before it is set in an ivar then it's
possible to just override #set method.

See spec/integration/virtus/attributes/attribute/set_spec.rb
@solnic Extract typecasting responsibility into separate classes d935b78
@solnic Fix end-of-class comments in Typecast 2eab0db
@solnic Replace Typecast::Base with Typecast::Object 4a96b13
@solnic Adjust flay threshold 1838018
@solnic Oops forgot to delete that in my previous commit f62c022
Commits on Jul 20, 2011
@solnic Typo fix 25287ff
@solnic Use Virtus::Typecast#[] to retrieve a class for typecasting 9f7e1fb
@solnic Add missing methods to Virtus::Typecast::Object 419ceb2
@solnic Add Typecast::Hash.to_array f0f4997
@solnic Add Typecast::Array (empty for now) 00d82d0
@solnic Add missing docs for Typecast::BigDecimal a3f509b
@solnic Adjust flay threshold 060f9dd
@solnic Regenerate gemspec 4288a34
@solnic Small simplification of typecast specs 9508da8
@solnic History update 49c6c6d
@solnic Mark #get, #get!, #set and #set! as a part of the public API 1049b43
@solnic History update fda7d5d
@solnic TODO update d8f05d9
@solnic README update 226f299
@solnic Typecast::Array will be more useful when we actually require it :) ca54b2e
@solnic Passthrough value even if it is nil or primitive 861c046
@solnic Use #const_get in Typecast[] 78e7787
@dkubb dkubb Simplified Virtus::Attribute.set_options cdcec5b
@dkubb dkubb Minor formatting fix 57476aa
@dkubb dkubb Minor formatting/doc fix 6212e7d
@dkubb dkubb The value must be a string in Typecast::String.to_boolean, remove unn…
…ecessary code
@dkubb dkubb Use .to_string helper method to convert to a string rather than doing…
… it inline
@dkubb dkubb Minor whitespace fix d09a83c
@dkubb dkubb Removed unnecessary self. qualification 8610f8d
@dkubb dkubb Added to_string methods to typecasting subclasses
* Updated methods to use to_string instead of calling value.to_s inline
@dkubb dkubb Fixed to_string documentation 062c5bd
@dkubb dkubb Updated Object to pass-through values using method_missing a4364c1
@dkubb dkubb Minor documentation fix 350354f
@dkubb dkubb Added missing to_string method to Typecast::TrueClass and Typecast::F…

* The plan is to extract this into a shared module, but for now specify this
@dkubb dkubb Explicit specify the constant namespace for >= 1.9 1469189
@dkubb dkubb Removed unused typecasting class a93d0ad
@dkubb dkubb Make Typecast::Hash.extract private ae8142c
@dkubb dkubb Updated Typecast::Fixnum.to_boolean to handle non 1 or 0 numbers db2f79f
@dkubb dkubb Added Typecast::BigDecimal specs 1440b00
@dkubb dkubb Added Typecast::Date specs a49cd14
@dkubb dkubb Added Typecast::DateTime specs 37ed086
@dkubb dkubb Added specs for Typecast::FalseClass ce8f1eb
@dkubb dkubb Added specs for Typecast::Fixnum a9fc3c2
@dkubb dkubb Added specs for Typecast::Float 65ec33a
@dkubb dkubb Added specs for Typecast::Hash a2d77ca
@dkubb dkubb Fixed spec failures on >= 1.9 3d79fa7
@dkubb dkubb Updated travis-ci configuration to test more versions of ruby 59db2d8
Commits on Jul 22, 2011
@solnic Add Typecast::String.to_boolean specs d4b07df
@solnic Add Typecast::String.to_date specs eedb1ff
@solnic Add Typecast::String.to_datetime specs c21b284
@solnic Add Typecast::String.to_time specs 5fd97c2
@solnic Add Typecast::TrueClass.to_string specs 603368b
@solnic Add Typecast::Symbol.to_string specs 3593148
@solnic Rename #to_i => #to_integer and add Typecast::String.to_integer specs 6337c78
@solnic Rename #to_f => #to_float and add Typecast::String.to_float specs b49050a
@solnic Rename #to_d => #to_decimal and add Typecast::String.to_decimal specs 256850c
@solnic Adjust flay threshold ff47a75
@solnic Add Attribute.primitive? specs a696e87
@solnic Add Virtus::ClassMethods.attributes spec d2a59dd
@solnic Add Typecast::Object.method_missing specs bf05c6b
@solnic Make Typecast::Date.to_time work with 1.8 e9dde10
@solnic TODO update b5b9b4d
@solnic Add contributors section to README ddcc8c1
@solnic Oops, sorry Chris :) e5d155e
@solnic Fix Typecast::Object.method-missing spec for rbx 62d2bad
@solnic OK let's not check for that exception message so it passes on rbx 26d8559
Commits on Jul 23, 2011
@dkubb dkubb Minor whitespace fix 929bbf0
@dkubb dkubb Updated gemspec ba1e038
@dkubb dkubb Make sure Typecast::Object#to_* returns the object passed in aa9cf01
@dkubb dkubb Updated String .to_integer, .to_float and .to_decimal specs to test m…
…ore cases
@dkubb dkubb Removed unnecessary spec 7267724
@dkubb dkubb Minor whitespace fix bdd293b
@dkubb dkubb Typecast the time segment values to integers 251e56c
@dkubb dkubb YARD doc cleanup d1868ab
@dkubb dkubb Silence IrresponsibleModule warnings with proper class summary 405786f
@dkubb dkubb Adjusted flay, reek and roodi thresholds
* Use explicit return in rescue block to avoid reek errors
@dkubb dkubb Extracted common functionality from String Date/Time/DateTime parser …
@dkubb dkubb Update String numeric parser utility method to be private 0a7bc0c
@dkubb dkubb Simplified Virtus::ClassMethods#attribute
* Extracted common functionality into separate named methods
@dkubb dkubb Moved BigDecimal#to_s formatter into constant f9d4341
@dkubb dkubb Minor doc fixes 59cd843
@dkubb dkubb Minor code formatting fix 4de18ef
@dkubb dkubb Updated docs to be consistent and make sure they use the proper optio…
…n names
@dkubb dkubb Remove hard coded class from Attribute.determine_type
* This code is going to be extracted from Attribute, so I thought to
  generalize it first before extracting. The behaviour should remain
  unchanged from the original, except perhaps you could have more than
  on direct Attribute descendant and have it work now, where before
  it *had* to be an Attribute::Object. Since we control the object
  heirarchy, we can ensure that Attribute::Object is the only direct
* Removed redundant comments from Attribute.determine_type
@solnic Remove :complex option
It was only needed for my experimental dirty tracking feature which is
no longer part of Virtus
@solnic Adjust flay threshold 81d3ac7
Commits on Jul 24, 2011
@dkubb dkubb Factored out type lookup from Virtus::Attribute into Virtus::TypeLookup 486b454
@dkubb dkubb Adjusted flay, reek and roodi thresholds 0c5f0e1
Commits on Jul 25, 2011
@solnic Typecast => Coercion 7ed04cb
@solnic Regenerate gemspec 31e9ec7
@solnic Use TypeLookup in Coercion classes 339fcb8
@solnic #typecast => #coerce & #typecast_method => #coercion_method 8d86f1c
@solnic Adjust flay threshold 89175ea
@solnic Add description to Coercion class bf61822
Commits on Jul 26, 2011
@solnic Add information about coercions to README file 105d4b6
@solnic Add specs for examples in README 4650bad
@solnic History update e97ee9f
@solnic gemspec update 62a5bd6
@solnic Adjust flay threshold 7350e88
@solnic Update TODO 5b614ba
@solnic Fixed README formatting 2e28d3c
Commits on Jul 28, 2011
@solnic Extract options API into a shared module 64bec89
@solnic Extend Coercion with Options and set primitive option on all classes 915c61b
@solnic Rename Coercion::BigDecimal => Coercion::Decimal 9351d52
@solnic Rename Coercion::Fixnum => Coercion::Integer 09677cd
@solnic Add Coercion::Numeric to DRY up numeric coercion classes b87fb73
@solnic Extract common time coercions into TimeCoercions shared module 35b1c60
@solnic Adjust flay threshold down to 20.0 from 53 and total to 260 :D ecbcd21
@solnic Add missing description to Coercion::Numeric d95ef3d
@solnic Add missing description to Coercion::TimeCoercions module 56d91ba
@solnic Remove Coercion::String.primitive method 8cb58bb
@solnic TODO update 8b6971e
@solnic Syntax highlight in README f0c5832
@solnic Regenerate gemspec cccf9c7
@solnic Add notifications config to travis 8c0b1b9
@solnic Update travis config e25f719
Commits on Jul 29, 2011
@solnic Set ::Integer as Coercion::Integer primitive 42d8745
@solnic DRY up Coercion::TimeCoercions f78e1ec
@solnic Adjust flay total 1a78daa
@solnic Minor fixes in TimeCoercions docs 2cdc982
@solnic Add unit specs for Virtus::Options b01b0b2
@solnic README update 9bfc2c6
@solnic Adjust reek configuration a95b67f
@solnic Version bump to 0.0.6 12018a0
@solnic Regenerate gemspec 299bd23
@solnic Update History 58eb9fe
@solnic Add missing v0.0.5 release to History 91d33a6
@solnic Add yardopts 19377c2
@solnic Add missing User class to Coercion example in README 6df00da
@solnic TODO update c8e0602
@solnic Simplified Attribute#get spec 8312ccc
@solnic Simplified Attribute#set spec 31a48d4
@solnic Add support for default values a80fa33
@solnic Add description to the :default attr reader aa7d340
@solnic Adjust flay total 6d41e52
@solnic Add @example to Attribute#default_defined? c8727f7
@solnic Adjust reek config 3c9ab57
@solnic Regenerate gemspec 5e6038f
Commits on Jul 30, 2011
@solnic Always set default even if it is nil ec3e79b
@solnic Add support for proc defaults 91bd4ca
@solnic Adjust flay total 0bb5e8d
@solnic Regenerate gemspec ab57077
@solnic Add InstanceMethods#to_hash f375f2b
@solnic Add Attribute#inspect 58a7829
@solnic TODO update b962025
@solnic Regenerate gemspec 9f2bfcf
@solnic Add info about default values to README 749e93e
@solnic Default values example spec 0511431
@solnic Update History e6e7d51
@solnic Add @example to #inspect a8a00ba
@solnic Regenerate gemspec for version 0.0.6 25795a8