Class: ActiveFacts::Metamodel::Step

Inherits:
Object
  • Object
show all
Defined in:
lib/activefacts/vocabulary/metamodel.rb,
lib/activefacts/vocabulary/extensions.rb

Instance Method Summary collapse

Instance Method Details

#describeObject



935
936
937
938
939
940
941
942
943
# File 'lib/activefacts/vocabulary/extensions.rb', line 935

def describe
  "Step " +
    "#{is_optional ? 'maybe ' : ''}" +
    (is_unary_step ? '(unary) ' : "from #{input_play.describe} ") +
    "#{is_disallowed ? 'not ' : ''}" +
    "to #{output_plays.map(&:describe)*', '}" +
    (objectification_variable ? ", objectified as #{objectification_variable.describe}" : '') +
    " '#{fact_type.default_reading}'"
end

#external_fact_typeObject



962
963
964
# File 'lib/activefacts/vocabulary/extensions.rb', line 962

def external_fact_type
  fact_type.is_a?(LinkFactType) ? fact_type.role.fact_type : fact_type
end

#input_playObject



945
946
947
# File 'lib/activefacts/vocabulary/extensions.rb', line 945

def input_play
  all_play.detect{|p| p.is_input}
end

#is_objectification_stepObject



958
959
960
# File 'lib/activefacts/vocabulary/extensions.rb', line 958

def is_objectification_step
  !!objectification_variable
end

#is_unary_stepObject



953
954
955
956
# File 'lib/activefacts/vocabulary/extensions.rb', line 953

def is_unary_step
  # Preserve this in case we have to use a real variable for the phantom
  all_play.size == 1
end

#output_playsObject



949
950
951
# File 'lib/activefacts/vocabulary/extensions.rb', line 949

def output_plays
  all_play.reject{|p| p.is_input}
end