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

add param_accessor_style :accessors #74

Closed
catmando opened this issue Dec 5, 2018 · 4 comments
Closed

add param_accessor_style :accessors #74

catmando opened this issue Dec 5, 2018 · 4 comments
Labels
enhancement New feature or request ready-to-release Internal Use Only: Has been fixed, specs passing and pushed to edge branch
Milestone

Comments

@catmando
Copy link
Contributor

catmando commented Dec 5, 2018

which will create snake case param method accessors.

The underlying @CamelCased ivars will still exist, so these will just be low-toll wrappers to the ivars.

Eventually we will decide if we want to keep the @CamelCase as the default.

@camelCaseD
Copy link

FYI you pulled me into this. Please be careful what you type. If the above is suppose to be code surround it with back ticks

@catmando catmando added the enhancement New feature or request label Dec 7, 2018
@catmando catmando added this to the alpha1.3 milestone Dec 7, 2018
@catmando
Copy link
Contributor Author

fixed, sorry to disturb!

@catmando
Copy link
Contributor Author

closed. see hyper-component/spec/client_features/param_declaration_spec.rb it "can use accessor style param names" for example

@catmando catmando added the ready-to-release Internal Use Only: Has been fixed, specs passing and pushed to edge branch label Jan 15, 2019
@catmando
Copy link
Contributor Author

In summary here are how params look for the three options:

class Index < HyperComponent
  param_accessor_style :accessors
  param :scope  # scope instance variable is automatically created

  render(SECTION, class: :main) do
    UL(class: 'todo-list') do
      scope.each { |todo| TodoItem(todo: todo) }
    end
  end
end

with the legacy params wrapper:

class Index < HyperComponent
  param_accessor_style :legacy
  param :scope  # params are accessed via the params wrapper

  render(SECTION, class: :main) do
    UL(class: 'todo-list') do
      params.scope.each { |todo| TodoItem(todo: todo) }
    end
  end
end

and the default:

class Index < HyperComponent
  param_accessor_style :hyperstack # default!
  param :scope  # params are accessed via the camelized instance var

  render(SECTION, class: :main) do
    UL(class: 'todo-list') do
      @Scope.each { |todo| TodoItem(todo: todo) }
    end
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ready-to-release Internal Use Only: Has been fixed, specs passing and pushed to edge branch
Projects
None yet
Development

No branches or pull requests

2 participants