Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extend the attributes object with helper methods #1220

Merged
merged 1 commit into from
Oct 18, 2016

Conversation

chris-rock
Copy link
Contributor

  • add helper methods
  • allow the attribute object to generate ruby code

@chris-rock chris-rock added Type: Enhancement Improves an existing feature in progress labels Oct 14, 2016
@chris-rock chris-rock force-pushed the chris-rock/extend-attribute-object branch 2 times, most recently from 0a097c0 to cca17f9 Compare October 17, 2016 11:02
end

def ruby_var_identifier
'attr_' + @name.downcase.strip.tr(' ', '-').gsub(/[^\w-]/, '')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR looks good. What you think of updating this slug maker from:

[10] pry> " hello\tdear  spaces\n".downcase.strip.tr(' ', '-').gsub(/[^\w-]/, '')
=> "hellodear--spaces"

To:

[11] pry> " hello\tdear  spaces\n".downcase.strip.gsub(/\s+/, '-').gsub(/[^\w-]/, '')
=> "hello-dear-spaces"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, lets use your approach

Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
@chris-rock chris-rock force-pushed the chris-rock/extend-attribute-object branch from cca17f9 to c67ff8b Compare October 18, 2016 15:17
@alexpop
Copy link
Contributor

alexpop commented Oct 18, 2016

Looks good, merging. Thanks Chris!

@alexpop alexpop merged commit 5bca878 into master Oct 18, 2016
@alexpop alexpop deleted the chris-rock/extend-attribute-object branch October 18, 2016 15:27
@aaronlippold
Copy link
Collaborator

Should this also have the required boolean as well as part of the object?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Improves an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants