@@ -151,11 +151,11 @@ def self.expose(*args, &block)
151151 options = merge_options ( args . last . is_a? ( Hash ) ? args . pop : { } )
152152
153153 if args . size > 1
154- fail ArgumentError , 'You may not use the :as option on multi-attribute exposures.' if options [ :as ]
155- fail ArgumentError , 'You may not use block-setting on multi-attribute exposures.' if block_given?
154+ raise ArgumentError , 'You may not use the :as option on multi-attribute exposures.' if options [ :as ]
155+ raise ArgumentError , 'You may not use block-setting on multi-attribute exposures.' if block_given?
156156 end
157157
158- fail ArgumentError , 'You may not use block-setting when also using format_with' if block_given? && options [ :format_with ] . respond_to? ( :call )
158+ raise ArgumentError , 'You may not use block-setting when also using format_with' if block_given? && options [ :format_with ] . respond_to? ( :call )
159159
160160 if block_given?
161161 if block . parameters . any?
@@ -214,7 +214,7 @@ def self.can_unexpose?
214214 end
215215
216216 def self . cannot_unexpose!
217- fail "You cannot call 'unexpose` inside of nesting exposure!"
217+ raise "You cannot call 'unexpose` inside of nesting exposure!"
218218 end
219219
220220 # Set options that will be applied to any exposures declared inside the block.
@@ -270,7 +270,7 @@ def self.documentation
270270 # end
271271 #
272272 def self . format_with ( name , &block )
273- fail ArgumentError , 'You must pass a block for formatters' unless block_given?
273+ raise ArgumentError , 'You must pass a block for formatters' unless block_given?
274274 formatters [ name . to_sym ] = block
275275 end
276276
@@ -392,8 +392,8 @@ def self.present_collection(present_collection = false, collection_name = :items
392392 # @option options :only [Array] all the fields that should be returned
393393 # @option options :except [Array] all the fields that should not be returned
394394 def self . represent ( objects , options = { } )
395- if objects . respond_to? ( :to_ary ) && ! @present_collection
396- root_element = root_element ( :collection_root )
395+ if objects . respond_to? ( :to_ary ) && !@present_collection
396+ root_element = root_element ( :collection_root )
397397 inner = objects . to_ary . map { |object | new ( object , options . reverse_merge ( collection : true ) ) . presented }
398398 else
399399 objects = { @collection_name => objects } if @present_collection
@@ -485,7 +485,7 @@ def delegate_attribute(attribute)
485485 end
486486 end
487487
488- alias_method : as_json, : serializable_hash
488+ alias as_json serializable_hash
489489
490490 def to_json ( options = { } )
491491 options = options . to_h if options && options . respond_to? ( :to_h )
@@ -536,7 +536,7 @@ def self.merge_options(options)
536536 # @param options [Hash] Exposure options.
537537 def self . valid_options ( options )
538538 options . keys . each do |key |
539- fail ArgumentError , "#{ key . inspect } is not a valid option." unless OPTIONS . include? ( key )
539+ raise ArgumentError , "#{ key . inspect } is not a valid option." unless OPTIONS . include? ( key )
540540 end
541541
542542 options [ :using ] = options . delete ( :with ) if options . key? ( :with )
0 commit comments