Skip to content

object syntax to allow setting current object#32

Merged
ajsharp merged 2 commits intomasterfrom
set-current-object
Jun 14, 2013
Merged

object syntax to allow setting current object#32
ajsharp merged 2 commits intomasterfrom
set-current-object

Conversation

@ajsharp
Copy link
Copy Markdown
Owner

@ajsharp ajsharp commented Jun 6, 2013

This change allows you to set @current_object with the object method in order to use the attributes method in a top-level keyspace.

Person = Struct.new(:name, :age, :employer)
person = Person.new('alex', 28, 'Zaarly')

object person do
  attributes :id, :name, :employer
end

This will output the following json document:

{
  "name": "alex",
  "age": 28,
  "employer": "Zaarly"
}

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0%) when pulling 527f632 on set-current-object into 55a22fd on master.

@zk
Copy link
Copy Markdown
Collaborator

zk commented Jun 7, 2013

Looks great dude.

ajsharp added a commit that referenced this pull request Jun 14, 2013
object syntax to allow setting current object
@ajsharp ajsharp merged commit bb6af87 into master Jun 14, 2013
@ajsharp ajsharp deleted the set-current-object branch June 14, 2013 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants