Skip to content

add param_accessor_style :accessors #74

Closed

Description

@catmando

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.

Activity

  1. camelCaseD commented on Dec 5, 2018

    @camelCaseD

    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

  2. added this to the alpha1.3 milestone on Dec 7, 2018
  3. catmando commented on Dec 12, 2018

    @catmando
    ContributorAuthor

    fixed, sorry to disturb!

  4. catmando commented on Jan 15, 2019

    @catmando
    ContributorAuthor

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

  5. added
    ready-to-releaseInternal Use Only: Has been fixed, specs passing and pushed to edge branch
    on Jan 15, 2019
  6. catmando commented on Jan 17, 2019

    @catmando
    ContributorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestready-to-releaseInternal Use Only: Has been fixed, specs passing and pushed to edge branch

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions