Skip to content

Commit

Permalink
Change allowed fields to be more flexible
Browse files Browse the repository at this point in the history
  • Loading branch information
hainesr committed Feb 23, 2018
1 parent baf6530 commit 2f9b21b
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions lib/cff/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ class Model
include Util

ALLOWED_FIELDS = [
:cff_version,
:date_released,
:message,
:message=,
:title,
:title=,
:version
'cff-version',
'date-released',
'message',
'title',
'version'
].freeze # :nodoc:

# The default message to use if none is explicitly set.
Expand Down Expand Up @@ -97,9 +95,9 @@ def to_yaml # :nodoc:
end

def method_missing(name, *args) # :nodoc:
super unless ALLOWED_FIELDS.include?(name)

n = method_to_field(name.id2name)
super unless ALLOWED_FIELDS.include?(n.chomp('='))

if n.end_with?('=')
@fields[n.chomp('=')] = args[0] || ''
else
Expand Down

0 comments on commit 2f9b21b

Please sign in to comment.