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.5.1
This comparison is big! We’re only showing the most recent 250 commits
Commits on Feb 09, 2012
@senny senny do not require 'virtus' to keep examples short and focused 2eac761
@solnic Merge pull request #64 from senny/readme_cleanup
Readme cleanup
@solnic Update 8605e14
Commits on Feb 10, 2012
@dkubb dkubb Fix whitespace 4e439ca
@dkubb dkubb Fix documentation for Virtus::ValueObject::Equalizer e65e1c0
@dkubb dkubb Remove unecessary code, #compile returns self c6d2d80
@dkubb dkubb Refactor Virtus::ValueObject#equalizer to be simpler e83c253
@dkubb dkubb Change Heckle timeout to prevent run-away mutations from delaying the…
… heckle task
@dkubb dkubb Refactor Virtus::InstanceMethods code to share more common logic
* Change Virtus::InstanceMethods#get_attributes and
  Virtus::InstanceMethods#set_attributes to accept a block that yields to each
  attribute, and only get/set the value if the block returns true. This DRYs
  up the code in Virtus::InstanceMethods#attributes with
@dkubb dkubb Update flay threshold 08dacf9
@dkubb dkubb Test enabling spec to run under rbx in 1.9 mode in travis-ci 32b234a
Commits on Feb 11, 2012
@solnic Bump version to 0.2.1 d219998
@dkubb dkubb Change Virtus::Coercion::Object.method_missing to be a private method
* In general I prefer for method_missing methods to be declared as private
  because I don't want to accidentally expose them in the public interface.
@dkubb dkubb Add Virtus::Coercion::Object.to_array. Fixes #63
* Remove Virtus::Coercion::Hash.to_array since that case is now handled by this
  new method and no longer needs to be a special case for just Hash.
@dkubb dkubb Fix docs for Virtus::Coercion::Object.to_array e60ae10
@dkubb dkubb Add Virtus::Coercion::Object.to_hash
For #58
@dkubb dkubb Add example docs for Virtus::Coercion::Object.to_array and .to_hash 7ebbf64
@dkubb dkubb Update Virtus::Coercion::Object.to_hash docs 0e67ddd
@dkubb dkubb Fix failing specs in ruby >= 1.9
* In ruby 1.9 it always sends a #to_ary message to the object, and an rspec mock
  object will accept any message. Change to use a plain Object instance which
  resembles real-world usage more closely.
@dkubb dkubb Add a spec or Virtus::Coercion::Object.to_array for the #to_ary => ni…
…l case

* A lesser known behaviour of a #to_ary method is that if it return nil, that is
  a sign that the object is also not directly coercible into an Array, and that
  Kernel::Array() should fallback to looking or #to_a, and finally just wrap the
  object in an Array if #to_a is not accepted.
@dkubb dkubb Fix whitespace 23c5d6a
@dkubb dkubb Add descriptions of the example blocks in the docs 324604c
@dkubb dkubb Add Virtus::Coercion::Object.to_string
For #58
@dkubb dkubb Update flay threshold 59360d0
@dkubb dkubb Refactor Virtus::Coercion::Object to use a common method
* Refactor Virtus::Coercion::TimeCoercions to use common code
@dkubb dkubb Update flay threshold 79dad8e
@dkubb dkubb Fix description in the specs 9c849f1
@dkubb dkubb Add Virtus::Coercion::Object.to_integer
For #58
@dkubb dkubb Add jruby-head to the list of rubies for travis-ci to test with ba4b8c7
@dkubb dkubb Add language to travis-ci config b4637b7
Commits on Feb 12, 2012
@dkubb dkubb Update Virtus::Coercion::String.to_constant to handle namespaced names 8f878dd
@dkubb dkubb Update flay threshold e3d4596
@dkubb dkubb Update Virtus::ValueObject.included to be private
* In general I think all "hook" type methods should not be presented as part of
  the public API.
Commits on Feb 13, 2012
Markus Schirp Use EmbeddedValue#primitive instead of #model
The model attribute for EmbeddedValue had some kind of duplicated the
primitive lookup. Now OpenStruct is the default primitive for embedded
values, the user model still takes precedence.
@solnic Merge pull request #67 from mbj/fix/embedded-value-primitive
Use EmbeddedValue#primitive instead of #model
@dkubb dkubb Fix whitespace 03751b5
@solnic Bump version to 0.3.0 0db2d83
@fgrehm fgrehm "fix" typos on specs dc84bc9
@fgrehm fgrehm Adds pending integration specs for mass assignment with user defined …
Commits on Feb 14, 2012
@fgrehm fgrehm Adds class method to identify writer methods that can be mass-assigned cd756e4
@fgrehm fgrehm Make use of ClassMethods#allowed_writer_methods to check if an attrib…
…ute can be mass assigned and removes pending from related integration spec

Please note that value objects specs broke because of these changes
@fgrehm fgrehm Hacky way of getting value object specs green again c90ccaf
@dkubb dkubb Merge pull request #69 from fgrehm/fix-spec-typos
Fix spec typos
Commits on Feb 15, 2012
@solnic Add pelusa gem to rbx group bc1a949
Commits on Feb 17, 2012
@solnic Merge pull request #60 from senny/default_values_for_private_attributes
integration spec for default-values based on private attributes
@solnic Mark failing spec as pending 4bbe31e
@solnic Use pelusa from master b121a0c
@solnic Remove attr readers from Equalizer 5303a73
@solnic DRY-up Equalizer a bit 3ebeb17
@solnic Remove reader_visibility and writer_visibility
It's better to use public methods rather than accessing internal
instance variables via their attribute readers
@solnic Remove instance_variable_name in favor of directly accessing @instanc…
@solnic Update flay threshold 8a897c8
@solnic Update f6da8f8
Commits on Feb 21, 2012
@laserlemon laserlemon Fix build status and add dependency status image to README 6a52b59
@solnic Merge pull request #71 from laserlemon/patch-1
Fix build status and add dependency status image to README
Commits on Feb 22, 2012
@fgrehm fgrehm Simplify ClassMethods#allowed_writer_methods 711b035
@fgrehm fgrehm Remove TODO as I couldn't spot any other method for blacklisting b634846
@fgrehm fgrehm Extract allowed_writer_methods logic for value objects c1169d3
@fgrehm fgrehm Update docs for attribute values mass assignment 5775ca0
@fgrehm fgrehm Merge branch 'master' of git:// into accessor…
@fgrehm fgrehm Require backports after rubygems so that ruby 1.8 finds it 932ad5e
Commits on Feb 23, 2012
@dkubb dkubb Merge pull request #73 from fgrehm/fix-specs-for-ruby-1.8
Require backports after rubygems so that ruby 1.8 finds it
@fgrehm fgrehm Make use of .allowed_writer_methods from InstanceMethods#set_attribut…
…es and avoid the extra argument to the method
@fgrehm fgrehm Simplify ClassMethods#allowed_writer_methods 7860ecc
Commits on Feb 24, 2012
@solnic Merge pull request #72 from fgrehm/accessors-mass-assignment
Accessors mass assignment
@solnic Minor simplification of ClassMethods#allowed_writer_methods d356d65
@solnic Update flay threshold 7d3d6a4
@solnic Update flog threshold 97c2b5c
@solnic Update b8d8960
@solnic Introduce new classes for handling default values 44fd981
Commits on Feb 25, 2012
@solnic Make default value from method actually work 4e198e0
@solnic Extract default value classes into separate files dbbc1ea
@solnic Add missing yard docs to default value classes de98f9b
@solnic Use @value rather than attr_reader in default value classes aaab80d
@solnic Adjust flay threshold ad39206
@solnic Update TODO c1ff43b
@solnic Add integration spec for default values from a symbol 82d6a3e
@solnic Update 994e344
@solnic Update a3d02dd
@solnic Add fgrehm and mbj to the credits list 4186272
@solnic Update 53f8edb
Commits on Feb 26, 2012
@fgrehm fgrehm Update README example to be "copy-and-pastable" ef31ea2
@fgrehm fgrehm Fix default values example 51e420b
@solnic Update 99b1e91
@solnic Merge remote-tracking branch 'fgrehm/adjust-readme'
@solnic Fix whitespace 28a9840
Commits on Feb 29, 2012
@dkubb dkubb Update shared spec load path to be simpler c0b4158
@dkubb dkubb Fix specs to use the proper "from" value
* It looks like rspec 1 does not check the "from" value, only the "to" value,
  so make this change to allow the specs to pass with rspec 2.
@dkubb dkubb Fix spec by replacing the mock with an Object instance
* For some reason RSpec::Mocks::Mock defines #to_str in rspec 2, and with the
  spec we're trying to assert what will happen when a non-String-like object is
  passed to the string coercion method.
Commits on Mar 01, 2012
@dkubb dkubb Add specs for Virtus::Attribute::Collection#coerce
* The existing specs only tested two out of 3 possible states the method could
  exist in. Add another spec to cover the actual "happy path" when
  #coerce_and_append_member is implemented for the Collection subclass.
@dkubb dkubb Refactor Virtus::Attribute::Collection#coerce
* The names of the arguments passed into #coerce_and_append_member isn't an
  important detail for #coerce to know about, so just pass in all the args as-is
@dkubb dkubb Change Virtus::AttributesAccessor#inspect to be a regular method 49bb051
@dkubb dkubb Remove unecessary public accessor 9c213e5
@dkubb dkubb Change Virtus::AttributeSet to use only one Hash for the internal index fab0ba4
@dkubb dkubb Refactor Virtus::Coercion::String.to_constant
* Split constant lookup into a private method
@dkubb dkubb Update flay threshold d7ff633
Commits on Mar 02, 2012
@fgrehm fgrehm Do not throw exception when nil is passed to #attributes= 64c3ab0
Commits on Mar 11, 2012
@fgrehm fgrehm Duck type attribute values to hash when setting 680a59e
@fgrehm fgrehm Does not try to set attributes on initialization if provided argument…
… is nil
@fgrehm fgrehm Rename attribute_values variables to attributes for consistency 7cee90b
Commits on Mar 12, 2012
@fgrehm fgrehm Change InstanceMethods#initialize to check if object can be duck type…
…d to hash instead of checking if not nil
@fgrehm fgrehm Add a spec setting attributes with a value that cant be duck typed to…
… a hash
@fgrehm fgrehm Copy & paste is evil :P c8118c6
@dkubb dkubb Change to use #public_send instead of #send for public methods aa425b9
@dkubb dkubb Merge pull request #79 from fgrehm/fix-mass-assignment-with-nil
Do not throw exception when nil is passed to #attributes=
@dkubb dkubb Change Virtus::InstanceMethods#initialize to not create an empty hash…
… by default

* When no arguments are passed in, the end result is the same as when a nil is
  passed in, so there's no need to create an empty Hash and then "set" the
  internal state with it. Better to just default to nil, and short-circuit the
* Added specs so that if anything other than nil or an object that responds to
  #to_hash is passed in an exception is raised. Like DM1, by default I *only*
  want constructors handling Hash-like objects or nil; anything else passed in
  should be considered an exceptional case.
@dkubb dkubb Update reek thresholds d69bf78
@dkubb dkubb Refactor spec and cleanup descriptions c920b4b
@dkubb dkubb Replace usage of #to_hash with Hash.try_convert ab80aeb
@dkubb dkubb Update flay threshold ad9c0a2
Commits on Mar 13, 2012
@solnic Introduce simple caching mechanism for type lookup 2be5934
@solnic Adjust flay threshold c4a1af5
Commits on Mar 14, 2012
@solnic Set type lookup cache as an ivar rather than a constant fd35c09
@solnic Adjust flay threshold 12771ce
@solnic Update TODO 30d6295
@solnic Move Coercion::Array.to_set spec file 64113a2
@solnic Add pending spec examples 384068d
@solnic Move Coercion.[] spec to correct file 2db8c30
@solnic Add spec for Virtus::Attribute::Collection#coerce_and_append_member 5eefa9e
@solnic Update TODO 7e9332b
@solnic Add spec for Virtus::Attribute::Collection::MemberCoercion#coerce_and…
@solnic Add spec for Virtus::Attribute::Collection#member_type 9ded7e4
@solnic Add spec for Virtus::Attribute::Collection#new_collection dd86c99
@solnic Add an example to Virtus::Attribute::Collection#member_type spec df79b60
Commits on Mar 15, 2012
@solnic Add guard rspec d925c76
@solnic Fix whitespace 4e527b4
@solnic Add spec for 7320971
@solnic Add spec for Virtus::Attribute::DefaultValue::FromCallable.handle? 56fa179
@solnic Add spec for Virtus::Attribute::DefaultValue::FromClonable.handle? eeb6418
@solnic Add spec for Virtus::Attribute::DefaultValue::FromSymbol.handle? 0074019
@solnic Add a spec for Virtus::Attribute::DefaultValue::FromCallable#evaluate de97110
@solnic Add a spec for Virtus::Attribute::DefaultValue::FromClonable#evaluate b55fdec
@solnic Add a spec for Virtus::Attribute::DefaultValue::FromSymbol#evaluate 1524850
@solnic Remove redundant specifications from default value #evaluate specs 7d2f15b
Commits on Mar 16, 2012
@solnic Add spec for Virtus::AttributesAccessor#define_reader_method cd8a670
@solnic Add spec for Virtus::AttributesAccessor#defined_writer_method a96f18a
Commits on Mar 19, 2012
@solnic Add specs for Virtus::Coercion.primitive 22bdc71
@solnic Add spec for Virtus::Coercion::Decimal.to_decimal 6327b6e
@solnic Add spec for Virtus::Coercion::Float.to_float dd9237d
@solnic Add spec for Virtus::Coercion::Integer.to_integer 80fdaf2
@solnic Add spec for Virtus::Coercion::String.to_symbol 73e6823
@solnic Add spec for Virtus::Coercion::Time.to_integer 9fe3f5e
@solnic Add spec for Virtus::TypeLookup.extended 721d578
@solnic Add spec for Virtus::ValueObject.attribute 9cc4918
@solnic Add spec for Virtus::ValueObject::Equalizer#<< b06a3b6
@solnic Fix visibility of Virtus::ValueObject::Equalizer#compile 2d788d7
@solnic Remove pending case from determine_type spec 6c0af33
Commits on Mar 22, 2012
@solnic Use real decimal object in Virtus::Coercion::Decimal.to_decimal a867738
@solnic Use real float object in Virtus::Coercion::Float.to_float 1f56d58
@solnic Use real integer object in Virtus::Coercion::Integer.to_integer spec b8ca28c
@solnic Fix Virtus::ValueObject::Equalizer#<< spec for jruby in 1.9 mode 014b278
@solnic Bump version to 0.4.0 4b92776
@solnic Update Changelog 3fc107b
@solnic Update Changelog a9c31d5
Commits on Mar 25, 2012
@solnic Bump backports to 2.5.0 cbcd787
@solnic Bump version to 0.4.1 bdff0ae
Commits on Mar 30, 2012
@solnic Downgrade backports until rbx issues are fixed a0dcd67
Commits on Mar 31, 2012
@solnic Bump backports to 2.5.1 6ccdc6a
Commits on Apr 02, 2012
@dkubb dkubb Add stub spec files 56b39f6
@dkubb dkubb Change heckle task to raise when a spec file is missing 795ff79
@dkubb dkubb Fix whitespace 3b112a4
@dkubb dkubb Add spec for Virtus::Coercion::Numeric.to_decimal d5dc13c
@dkubb dkubb Add spec for Virtus::Coercion::Numeric.to_float d63156d
@dkubb dkubb Add spec for Virtus::Coercion::Numeric.to_integer d25c4c9
@dkubb dkubb Add spec for Virtus::Coercion::Numeric.to_string b7c082e
@dkubb dkubb Fix docs for Virtus::Coercion::Numeric to use the proper types 2c96f30
@dkubb dkubb Add spec for Virtus::Coercion::TimeCoercions.to_date 30ee06e
@dkubb dkubb Add spec for Virtus::Coercion::TimeCoercions.to_datetime 212ff87
@dkubb dkubb Add spec for Virtus::Coercion::TimeCoercions.to_time b915186
@dkubb dkubb Add spec for Virtus::Coercion::TimeCoercions.to_string ac1ba5a
@dkubb dkubb Rename spec for Virtus::ValueObject::InstanceMethods#with to the prop…
…er location
@dkubb dkubb Refactor Virtus::ValueObject::Equalizer#compile_strings_for_equivalen…
@dkubb dkubb Refactor Virtus::ValueObject::ClassMethods#attribute specs
* Include matcher for equalizer setuop
* Clean up specs to match conventions elsewhere
@dkubb dkubb Add a comment to #compile_strings_for_equivalent_method to make it mo…
…re clear
@solnic Fix Numeric.to_string spec 4248099
@solnic Fix whitespaces 5e3ca0d
@solnic Rename DefaultValue#evaluate => DefaultValue#call aa661c2
@solnic Decouple DefaultValue from the attribute instance 3d6d179
@solnic Simplify DefaultValue.handle? aeb0ded
@solnic Fix DefaultValue docs be57fb7
@dkubb dkubb Fix whitespace a47a9bc
@dkubb dkubb Remove explicit require of rubygems 591db91
@dkubb dkubb Change Gemfile to reference secure rubygems URL d4cc58d
@dkubb dkubb Add my email address to the list of people to notify when the build b…
@solnic Simplify DefaultValue::FromSymbol#call signature db48699
Commits on Apr 05, 2012
@dkubb dkubb Fix whitespace 76452c3
@dkubb dkubb Refactor Virtus::ValueObject::Equalizer
* Change string class_eval for declaring the methods to a normal define_method.
  Even though this boosts some of the metrics thresholds, I felt it was
  necessary to avoid "hiding" the complexity inside a string and evaling it.
* Move #eql? and #== into a plain module, and just define a #cmp? method that
  they can both share. We use a similar approach in DM.
* Change constructor so that it dupes and freezes the String and Array passed
  in to avoid mutating the objects in the caller's scope.
* Change #<< to return self on it's own rather than relying on a private method
  just happening to return self, even though taken in isolation the method
  has no reason to do this.
* Remove recompilation from every assigment to @keys.
@dkubb dkubb Rename Virtus::ValueObject::Equalizer to Virtus::Equalizer
* Move require statements in lib files into virtus.rb in the root lib directory
@dkubb dkubb Change to use the lower precedence "or" and "and" connectors where po…
@dkubb dkubb Remove work-around for special case with rbx now that it is fixed b561c6e
@dkubb dkubb Update flay threshold b2e5773
Commits on May 01, 2012
@senny senny ignore binstubs generated by bundle --binstubs 484a454
@senny senny integration spec to illustrate ValueObject duplication 559960f
Commits on May 06, 2012
@solnic Add backports to runtime deps f08407b
@solnic Remove information about backports from README 639bd2b
@solnic Update c1179db
Commits on May 08, 2012
@solnic Bump version to 0.4.2 2240efa
@solnic Bump backports dep to ~> 2.5.3 45d557e
@solnic Changelog update 558709d
Commits on May 11, 2012
@solnic Bump guard-rspec dep 538022e
@solnic Allow any input for EmebddedValue or ValueObject constructor, not jus…
…t Hash

Closes #88
@solnic Bump version to 0.4.3 7a02c9f
@solnic Update 4726730
Commits on May 13, 2012
@solnic Add support for Struct as an EmmbeddedValue or ValueObject 5910243
@solnic Add an integration spec for Struct as an EV 1d8763e
@solnic Dooh, fix spec for 1.8.7 9591d72
@solnic Fix typo 2e966c9
@solnic Bump version to 0.5.0 0d00ed1
@solnic Update Changelog 1fd6db7
Commits on May 17, 2012
@senny senny ValueObject #clone and #dup return self 0402b3e
@dkubb dkubb Merge pull request #87 from senny/topic/value_object_copies
ValueObject should not be duplicated
@solnic Update b97afea
Commits on May 18, 2012
@solnic Initial work on Virtus modules 5600671
@solnic No idea why I added reverse there fb30a55
Commits on Jun 04, 2012
@snusnu snusnu Bump backports dep to ~> 2.6.1
This makes virtus coexist peacefully with lastest
dm-core and veritas related master sources.
@solnic Merge pull request #91 from snusnu/bump_backports
Bump backports dep to ~> 2.6.1
@solnic Make Virtus work with classes, instances and modules (messy spike com…
@solnic Merge branch 'master' into modules-spike 6f5924e
@solnic Add more use cases to the using modules integration spec 8f3c2a6
@dkubb dkubb Rename ClassExtensions to ClassInclusions
* Change so that ClassInclusions is included, since it mostly just extends the
  descendant and adds instance methods.
@solnic Remove AllowedWriterMethods 7e30658
@solnic Move allowed_writer_methods down a bit 76e6a35
@dkubb dkubb Remove unecessary line from protected method e256f84
@dkubb dkubb Change methods to be private d81ac7d
@dkubb dkubb Add @api private doc to public_method_list e01b2d1
@dkubb dkubb Fix whitespace 342cb26
@solnic Rename _attributes to attribute_set 371c2c9
Commits on Jun 06, 2012
@solnic Bump guard-rspec version dep a643942
@solnic Merge branch 'master' into modules-spike 6d03269
Commits on Jun 08, 2012
@apotonick apotonick be kind and call super in ModuleExtensions#extended and #included to …
…allow other frameworks hooking into extention mechanism, too.
@solnic Merge pull request #92 from apotonick/modules-spike
Call super when extending
@solnic Fix Virtus.extended visibility 04f8567
@solnic Rename InstanceExtensions to just Extensions 023fdee
@solnic Fix visibility of Extensions.extended 76acc2d
@solnic Adjust flay threshold 57706fa
@solnic Raise argument error if Virtus is being included into an unsupported …
@solnic Go back to 100% doc coverage 3615ab4
@solnic Simplify Virtus.included (that case statement made no sense) 15ad0b5
@solnic Merge pull request #90 from solnic/modules-spike
Support extending modules and instances :gift:
@solnic Update README with modules and instances examples 96bffb4
@solnic Fix headers in README 28a01ee
@solnic Deprecate ClassMethods.attributes 68ce27f
@solnic Update changelog c28f9a6
@solnic Changelog update 45d6536
@solnic Fix example in README 9709ddc
@dkubb dkubb Add heading for class usage be9930d
@dkubb dkubb Update Copyright year 405ef9d
Commits on Jun 11, 2012
@solnic Handle nil values properly in EV
[fixes #94]
@solnic Bump version to 0.5.1 6a04d15
@solnic Changelog update dcdbb3c