lib/rubicure/girl.rb in rubicure-0.3.1 vs lib/rubicure/girl.rb in rubicure-0.3.2

- old
+ new

@@ -33,11 +33,11 @@ # human -> precure ( -> extra forms ) -> human ... # @return [Rubicure::Girl] self def transform! state = inc_current_state - print_by_line transform_message if state == 1 + print_by_line transform_message if state == 1 self end def humanize! @@ -46,11 +46,11 @@ end alias_method :humanize, :humanize! deprecate humanize: "Use #humanize! instead of #humanize" def attack! - raise "require transform" if current_attack_message.blank? + raise RequireTransformError, "require transform" if current_attack_message.blank? print_by_line current_attack_message current_attack_message end @@ -64,11 +64,11 @@ birthday_date = Date.new(date.year, month.to_i, day.to_i) birthday_date == date end - def have_birthday? + def have_birthday? # rubocop:disable Style/PredicateName respond_to?(:birthday) end alias_method :has_birthday?, :have_birthday? class << self @@ -141,38 +141,38 @@ end end private - def inc_current_state - @current_state = current_state + 1 - @current_state = 0 unless @current_state < state_names.length - @current_state - end + def inc_current_state + @current_state = current_state + 1 + @current_state = 0 unless @current_state < state_names.length + @current_state + end - def current_attack_message - attack_messages[@current_state - 1] - end + def current_attack_message + attack_messages[current_state - 1] if current_state > 0 + end - def print_by_line(message) - index = 0 - message.each_line do |line| - sleep(self.class.sleep_sec) if index > 0 - @io.puts line - index += 1 + def print_by_line(message) + index = 0 + message.each_line do |line| + sleep(self.class.sleep_sec) if index > 0 + @io.puts line + index += 1 + end end - end - def method_missing(method_name, *args) - # call Hashie::Extensions::MethodAccess#method_missing - return super if has_key?(method_name) + def method_missing(method_name, *args) + # call Hashie::Extensions::MethodAccess#method_missing + return super if has_key?(method_name) - shortened_name = method_name.to_s. - sub(/\Aprecure_|_precure\z/, ""). - sub(/!\z/, "") + shortened_name = method_name.to_s. + sub(/\Aprecure_|_precure\z/, ""). + sub(/!\z/, "") - return transform!(*args) if transform_calls.include?(shortened_name) + return transform!(*args) if transform_calls.include?(shortened_name) - super - end + super + end end end