<commit_before>use action::Action;
use config;
use context::base::BaseContext;
use dispatcher::Response;
use dispatcher::response::ResponseSender;
use message::{Builder, Message};
use std::cell::RefCell;
use std::rc::Rc;
use state::State;

#[derive(Clone)]
pub struct MessageAction {
    pub sender: Rc<RefCell<Box<ResponseSender<Response>>>>,
    pub action: config::action::MessageAction
}

#[derive(Debug)]
pub struct MessageResponse {
    message: Message,
}

impl Action for MessageAction {
    fn execute(&self, _state: &State, _context: &BaseContext) {
        println!("MessageAction is executed");
        let mut message = Builder::new("d6621bd6-4898-4b8c-a4ff-36d0eed7d8dc")
                                .pair(".context.uuid", &_context.uuid().to_hyphenated_string())
                                .pair(".context.len", &_state.messages().len().to_string())
                                .build();
        if let Some(name) = _context.name() {
            message.insert(".context.name", name);
        }
        let response = MessageResponse {
            message: message,
        };
        self.sender.borrow_mut().send_response(Response::Message(response));
    }
}<commit_msg>MessageResponse: add message() method<commit_after>use action::Action;
use config;
use context::base::BaseContext;
use dispatcher::Response;
use dispatcher::response::ResponseSender;
use message::{Builder, Message};
use std::cell::RefCell;
use std::rc::Rc;
use state::State;

#[derive(Clone)]
pub struct MessageAction {
    pub sender: Rc<RefCell<Box<ResponseSender<Response>>>>,
    pub action: config::action::MessageAction
}

#[derive(Debug)]
pub struct MessageResponse {
    message: Message,
}

impl MessageResponse {
    pub fn message(&self) -> &Message {
        &self.message
    }
}

impl Action for MessageAction {
    fn execute(&self, _state: &State, _context: &BaseContext) {
        println!("MessageAction is executed");
        let mut message = Builder::new("d6621bd6-4898-4b8c-a4ff-36d0eed7d8dc")
                                .pair(".context.uuid", &_context.uuid().to_hyphenated_string())
                                .pair(".context.len", &_state.messages().len().to_string())
                                .build();
        if let Some(name) = _context.name() {
            message.insert(".context.name", name);
        }
        let response = MessageResponse {
            message: message,
        };
        self.sender.borrow_mut().send_response(Response::Message(response));
    }
}
{'fraction_non_alphanumeric': 0.14246031746031745, 'fraction_numerical': 0.013492063492063493, 'mean_word_length': 2.9085271317829458, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '88244', 'n_tokens_mistral': 740, 'n_tokens_neox': 730, 'n_words': 148}