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

Extract `Site#filter_entries` into a method object #1697

Merged
merged 2 commits into from Nov 5, 2013

Conversation

Projects
None yet
3 participants
@mattr-
Copy link
Member

mattr- commented Nov 5, 2013

Related to #1572, this pulls the hunk of code that's in Site#filter_entries into its own object using the method object pattern and simplifies it a great deal. The filter_entries API in the Site class is kept in place in order to maintain backwards compatibility.

['.', '_', '#'].include?(entry[0..0])
end

def backup?(entry)

This comment has been minimized.

@parkr

parkr Nov 5, 2013

Member

vim_poop? would be funny. This is probably better though.

This comment has been minimized.

@mattr-

mattr- Nov 5, 2013

Author Member

Too bad that method names can't be emoji, then I could have just used 💩

😆

end

should "filter entries" do
ent1 = %w[foo.markdown bar.markdown baz.markdown #baz.markdown#

This comment has been minimized.

@parkr

parkr Nov 5, 2013

Member

Want to also test files in subdirs here? So if I have baz/#foo.markdown it'll still ignore?

This comment has been minimized.

@mattr-

mattr- Nov 5, 2013

Author Member

These are just the same tests extracted from test_site.rb so I'll make a note to add one for subdirectories.

This comment has been minimized.

@mattr-

mattr- Nov 5, 2013

Author Member

I tried to add this quickly and it failed. Considering how filter_entries is used currently - there is a Dir.chdir into every directory we want to filter entries from - should the lack of this extra test case block merging this in?

This comment has been minimized.

@parkr

parkr Nov 5, 2013

Member

If it is only meant to filter entries in the current directory, then I'm OK with it.

We could also do a entry.split($\).last to get the entries if it contains the $\ character. That is altering the behavior though so I'd probably say just leave it as-is and :shipit:.

@parkr

This comment has been minimized.

Copy link
Member

parkr commented Nov 5, 2013

All the yes. 👍 Just a couple comments.

mattr- added a commit that referenced this pull request Nov 5, 2013

Merge pull request #1697 from mojombo/entry-filter-method-object
Extract `Site#filter_entries` into a method object

@mattr- mattr- merged commit a05e8af into master Nov 5, 2013

1 check passed

default The Travis CI build passed
Details

@mattr- mattr- deleted the entry-filter-method-object branch Nov 5, 2013

mattr- added a commit that referenced this pull request Nov 5, 2013

csim added a commit to csim/jekyll that referenced this pull request Nov 7, 2013

@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.